home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / develop™ Technical Journal / develop Issue 27 code / Internet_Config_Assistant.sit / Internet Config Assistant / toolkit / NeoTextBox.c < prev    next >
MacBinary  |  1996-06-30  |  13.1 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Sun Jun 30 13:51:49 1996, modified Sun Jun 30 13:51:49 1996, creator 'CWIE', type ASCII, 12572 bytes "NeoTextBox.c" , at 0x319c 564 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 4e 65 6f 54 65 78 | 74 42 6f 78 2e 63 00 00 |..NeoTex|tBox.c..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 31 1c 00 | 00 02 34 ad fc 6f 35 ad |.....1..|..4..o5.|
|00000060| fc 6f 35 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.o5.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 b4 66 00 00 |........|.....f..|
|00000080| 2f 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |/*******|********|
|00000090| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000d0| 2a 0d 0d 20 20 4e 65 6f | 54 65 78 74 42 6f 78 2e |*.. Neo|TextBox.|
|000000e0| 63 20 2d 20 61 20 72 65 | 70 6c 61 63 65 6d 65 6e |c - a re|placemen|
|000000f0| 74 20 66 6f 72 20 54 65 | 78 74 42 6f 78 0d 0d 20 |t for Te|xtBox.. |
|00000100| 20 57 72 69 74 74 65 6e | 20 62 79 20 42 72 79 61 | Written| by Brya|
|00000110| 6e 20 4b 2e 20 52 65 73 | 73 6c 65 72 20 28 42 65 |n K. Res|sler (Be|
|00000120| 61 6b 65 72 29 0d 0d 2a | 2a 2a 2a 2a 2a 2a 2a 2a |aker)..*|********|
|00000130| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000140| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000150| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000160| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000170| 2a 2a 2a 2a 2a 2a 2a 2f | 0d 2f 2f 23 69 6e 63 6c |*******/|.//#incl|
|00000180| 75 64 65 20 22 4e 54 42 | 44 65 6d 6f 2e 68 22 0d |ude "NTB|Demo.h".|
|00000190| 23 69 6e 63 6c 75 64 65 | 20 22 4e 65 6f 54 65 78 |#include| "NeoTex|
|000001a0| 74 42 6f 78 2e 68 22 0d | 23 69 6e 63 6c 75 64 65 |tBox.h".|#include|
|000001b0| 20 3c 53 63 72 69 70 74 | 2e 68 3e 0d 23 69 6e 63 | <Script|.h>.#inc|
|000001c0| 6c 75 64 65 20 3c 54 65 | 78 74 55 74 69 6c 73 2e |lude <Te|xtUtils.|
|000001d0| 68 3e 0d 0d 23 69 6e 63 | 6c 75 64 65 20 3c 46 6f |h>..#inc|lude <Fo|
|000001e0| 6e 74 73 2e 68 3e 0d 23 | 69 6e 63 6c 75 64 65 20 |nts.h>.#|include |
|000001f0| 3c 54 65 78 74 45 64 69 | 74 2e 68 3e 0d 23 69 6e |<TextEdi|t.h>.#in|
|00000200| 63 6c 75 64 65 20 3c 46 | 69 78 4d 61 74 68 2e 68 |clude <F|ixMath.h|
|00000210| 3e 0d 23 64 65 66 69 6e | 65 20 67 48 61 73 54 72 |>.#defin|e gHasTr|
|00000220| 75 65 54 79 70 65 20 74 | 72 75 65 0d 0d 2f 2a 2a |ueType t|rue../**|
|00000230| 20 53 54 41 54 49 43 20 | 50 52 4f 54 4f 54 59 50 | STATIC |PROTOTYP|
|00000240| 45 53 20 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |ES *****|********|
|00000250| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000260| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000270| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2f 0d 73 |********|*****/.s|
|00000280| 74 61 74 69 63 20 75 6e | 73 69 67 6e 65 64 20 73 |tatic un|signed s|
|00000290| 68 6f 72 74 20 4e 54 42 | 4c 69 6e 65 48 65 69 67 |hort NTB|LineHeig|
|000002a0| 68 74 28 75 6e 73 69 67 | 6e 65 64 20 63 68 61 72 |ht(unsig|ned char|
|000002b0| 20 63 6f 6e 73 74 2a 20 | 74 68 65 54 65 78 74 2c | const* |theText,|
|000002c0| 0d 09 09 09 09 09 09 09 | 09 09 75 6e 73 69 67 6e |........|..unsign|
|000002d0| 65 64 20 6c 6f 6e 67 20 | 74 65 78 74 4c 65 6e 2c |ed long |textLen,|
|000002e0| 0d 09 09 09 09 09 09 09 | 09 09 63 6f 6e 73 74 20 |........|..const |
|000002f0| 52 65 63 74 2a 20 77 72 | 61 70 42 6f 78 2c 0d 09 |Rect* wr|apBox,..|
|00000300| 09 09 09 09 09 09 09 09 | 73 68 6f 72 74 20 6c 68 |........|short lh|
|00000310| 43 6f 64 65 2c 0d 09 09 | 09 09 09 09 09 09 09 73 |Code,...|.......s|
|00000320| 68 6f 72 74 2a 20 73 74 | 61 72 74 59 29 3b 0d 73 |hort* st|artY);.s|
|00000330| 74 61 74 69 63 20 76 6f | 69 64 20 4e 54 42 44 72 |tatic vo|id NTBDr|
|00000340| 61 77 28 53 74 79 6c 65 | 64 4c 69 6e 65 42 72 65 |aw(Style|dLineBre|
|00000350| 61 6b 43 6f 64 65 20 62 | 72 65 61 6b 43 6f 64 65 |akCode b|reakCode|
|00000360| 2c 0d 09 09 09 09 09 75 | 6e 73 69 67 6e 65 64 20 |,......u|nsigned |
|00000370| 63 68 61 72 20 63 6f 6e | 73 74 2a 20 6c 69 6e 65 |char con|st* line|
|00000380| 53 74 61 72 74 2c 0d 09 | 09 09 09 09 6c 6f 6e 67 |Start,..|....long|
|00000390| 20 6c 69 6e 65 42 79 74 | 65 73 2c 0d 09 09 09 09 | lineByt|es,.....|
|000003a0| 09 63 6f 6e 73 74 20 52 | 65 63 74 2a 20 77 72 61 |.const R|ect* wra|
|000003b0| 70 42 6f 78 2c 0d 09 09 | 09 09 09 73 68 6f 72 74 |pBox,...|...short|
|000003c0| 20 61 6c 69 67 6e 2c 0d | 09 09 09 09 09 73 68 6f | align,.|.....sho|
|000003d0| 72 74 20 63 75 72 59 2c | 0d 09 09 09 09 09 73 68 |rt curY,|......sh|
|000003e0| 6f 72 74 20 62 6f 78 57 | 69 64 74 68 29 3b 0d 0d |ort boxW|idth);..|
|000003f0| 2f 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |/*******|********|
|00000400| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000410| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000420| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000430| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000440| 2a 0d 20 2a 0d 20 2a 20 | 4e 54 42 4c 69 6e 65 48 |*. *. * |NTBLineH|
|00000450| 65 69 67 68 74 20 2d 20 | 66 69 67 75 72 65 73 20 |eight - |figures |
|00000460| 6c 69 6e 65 20 68 65 69 | 67 68 74 0d 20 2a 0d 20 |line hei|ght. *. |
|00000470| 2a 20 49 6e 70 75 74 3a | 09 74 68 65 54 65 78 74 |* Input:|.theText|
|00000480| 09 09 74 68 65 20 65 6e | 74 69 72 65 20 74 65 78 |..the en|tire tex|
|00000490| 74 20 74 68 61 74 20 77 | 61 73 20 67 69 76 65 6e |t that w|as given|
|000004a0| 20 74 6f 20 74 68 65 20 | 4e 65 6f 54 65 78 74 42 | to the |NeoTextB|
|000004b0| 6f 78 20 63 61 6c 6c 0d | 20 2a 09 09 09 74 65 78 |ox call.| *...tex|
|000004c0| 74 4c 65 6e 09 09 74 68 | 65 20 6c 65 6e 67 74 68 |tLen..th|e length|
|000004d0| 20 69 6e 20 62 79 74 65 | 73 20 6f 66 20 74 68 65 | in byte|s of the|
|000004e0| 20 74 65 78 74 0d 20 2a | 09 09 09 6c 68 43 6f 64 | text. *|...lhCod|
|000004f0| 65 09 09 74 68 65 20 6c | 69 6e 65 20 68 65 69 67 |e..the l|ine heig|
|00000500| 68 74 20 63 6f 64 65 20 | 74 68 61 74 20 77 61 73 |ht code |that was|
|00000510| 20 70 61 73 73 65 64 20 | 74 6f 20 4e 65 6f 54 65 | passed |to NeoTe|
|00000520| 78 74 42 6f 78 0d 20 2a | 09 09 09 73 74 61 72 74 |xtBox. *|...start|
|00000530| 59 09 09 56 41 52 20 2d | 20 77 65 20 72 65 74 75 |Y..VAR -| we retu|
|00000540| 72 6e 20 74 68 65 20 73 | 74 61 72 74 69 6e 67 20 |rn the s|tarting |
|00000550| 76 65 72 74 69 63 61 6c | 20 70 65 6e 20 6c 6f 63 |vertical| pen loc|
|00000560| 61 74 69 6f 6e 20 68 65 | 72 65 0d 20 2a 0d 20 2a |ation he|re. *. *|
|00000570| 20 4f 75 74 70 75 74 3a | 09 72 65 74 75 72 6e 73 | Output:|.returns|
|00000580| 20 74 68 65 20 6c 69 6e | 65 20 68 65 69 67 68 74 | the lin|e height|
|00000590| 20 74 6f 20 75 73 65 0d | 20 2a 09 09 09 0d 2a 2a | to use.| *....**|
|000005a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000005b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000005c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000005d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000005e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2f 0d |********|******/.|
|000005f0| 75 6e 73 69 67 6e 65 64 | 20 73 68 6f 72 74 20 4e |unsigned| short N|
|00000600| 54 42 4c 69 6e 65 48 65 | 69 67 68 74 28 75 6e 73 |TBLineHe|ight(uns|
|00000610| 69 67 6e 65 64 20 63 68 | 61 72 20 63 6f 6e 73 74 |igned ch|ar const|
|00000620| 2a 20 74 68 65 54 65 78 | 74 2c 0d 09 09 09 09 09 |* theTex|t,......|
|00000630| 09 09 20 75 6e 73 69 67 | 6e 65 64 20 6c 6f 6e 67 |.. unsig|ned long|
|00000640| 20 74 65 78 74 4c 65 6e | 2c 0d 09 09 09 09 09 09 | textLen|,.......|
|00000650| 09 20 63 6f 6e 73 74 20 | 52 65 63 74 2a 20 77 72 |. const |Rect* wr|
|00000660| 61 70 42 6f 78 2c 0d 09 | 09 09 09 09 09 09 20 73 |apBox,..|...... s|
|00000670| 68 6f 72 74 20 6c 68 43 | 6f 64 65 2c 0d 09 09 09 |hort lhC|ode,....|
|00000680| 09 09 09 09 20 73 68 6f | 72 74 2a 20 73 74 61 72 |.... sho|rt* star|
|00000690| 74 59 29 0d 7b 0d 09 73 | 68 6f 72 74 20 61 73 63 |tY).{..s|hort asc|
|000006a0| 2c 0d 09 64 65 73 63 3b | 09 09 09 09 09 09 09 09 |,..desc;|........|
|000006b0| 09 09 2f 2a 20 55 73 65 | 64 20 69 6e 20 74 68 65 |../* Use|d in the|
|000006c0| 20 4f 75 74 6c 69 6e 65 | 4d 65 74 72 69 63 73 20 | Outline|Metrics |
|000006d0| 63 61 6c 6c 73 20 2a 2f | 0d 09 46 6f 6e 74 49 6e |calls */|..FontIn|
|000006e0| 66 6f 20 66 49 6e 66 6f | 3b 09 09 09 09 09 09 09 |fo fInfo|;.......|
|000006f0| 09 2f 2a 20 54 68 65 20 | 6f 6c 64 2d 73 74 79 6c |./* The |old-styl|
|00000700| 65 20 66 6f 6e 74 20 69 | 6e 66 6f 72 6d 61 74 69 |e font i|nformati|
|00000710| 6f 6e 20 72 65 63 6f 72 | 64 20 2a 2f 0d 09 50 6f |on recor|d */..Po|
|00000720| 69 6e 74 20 66 72 61 63 | 3b 09 09 09 09 09 09 09 |int frac|;.......|
|00000730| 09 09 2f 2a 20 54 68 65 | 20 66 72 61 63 74 69 6f |../* The| fractio|
|00000740| 6e 20 66 6f 72 20 74 68 | 65 20 54 72 75 65 54 79 |n for th|e TrueTy|
|00000750| 70 65 20 63 61 6c 6c 73 | 20 2a 2f 0d 09 75 6e 73 |pe calls| */..uns|
|00000760| 69 67 6e 65 64 20 73 68 | 6f 72 74 20 6c 69 6e 65 |igned sh|ort line|
|00000770| 48 65 69 67 68 74 3b 09 | 09 09 09 09 2f 2a 20 54 |Height;.|..../* T|
|00000780| 68 65 20 72 65 74 75 72 | 6e 20 76 61 6c 75 65 20 |he retur|n value |
|00000790| 2a 2f 0d 0d 09 47 65 74 | 46 6f 6e 74 49 6e 66 6f |*/...Get|FontInfo|
|000007a0| 28 26 66 49 6e 66 6f 29 | 3b 0d 09 69 66 20 28 6c |(&fInfo)|;..if (l|
|000007b0| 68 43 6f 64 65 20 3c 20 | 30 29 0d 09 7b 0d 0d 09 |hCode < |0)..{...|
|000007c0| 09 2f 2a 0d 09 09 20 20 | 49 66 20 74 68 65 20 75 |./*... |If the u|
|000007d0| 73 65 72 20 68 61 73 20 | 73 70 65 63 69 66 69 65 |ser has |specifie|
|000007e0| 64 20 76 61 72 69 61 62 | 6c 65 2d 68 65 69 67 68 |d variab|le-heigh|
|000007f0| 74 20 6c 69 6e 65 73 2c | 20 77 65 20 6e 65 65 64 |t lines,| we need|
|00000800| 20 74 6f 20 74 72 79 0d | 09 09 20 20 74 6f 20 64 | to try.|.. to d|
|00000810| 65 74 65 72 6d 69 6e 65 | 20 74 68 65 20 74 61 6c |etermine| the tal|
|00000820| 6c 65 73 74 20 61 73 63 | 65 6e 74 20 69 6e 20 74 |lest asc|ent in t|
|00000830| 68 65 20 67 69 76 65 6e | 20 74 65 78 74 2e 20 20 |he given| text. |
|00000840| 57 65 20 63 61 6e 20 6f | 6e 6c 79 0d 09 09 20 20 |We can o|nly... |
|00000850| 72 65 61 6c 6c 79 20 64 | 6f 20 74 68 69 73 20 69 |really d|o this i|
|00000860| 66 20 74 68 65 20 66 6f | 6e 74 20 69 73 20 61 20 |f the fo|nt is a |
|00000870| 54 72 75 65 54 79 70 65 | 20 66 6f 6e 74 2e 20 20 |TrueType| font. |
|00000880| 4f 74 68 65 72 77 69 73 | 65 2c 20 77 65 0d 09 09 |Otherwis|e, we...|
|00000890| 20 20 70 75 6e 74 20 61 | 6e 64 20 75 73 65 20 6f | punt a|nd use o|
|000008a0| 6c 64 2d 66 61 73 68 69 | 6f 6e 65 64 20 47 65 74 |ld-fashi|oned Get|
|000008b0| 46 6f 6e 74 49 6e 66 6f | 20 6e 75 6d 62 65 72 73 |FontInfo| numbers|
|000008c0| 2e 0d 09 09 2a 2f 0d 0d | 09 09 66 72 61 63 2e 68 |....*/..|..frac.h|
|000008d0| 20 3d 20 66 72 61 63 2e | 76 20 3d 20 31 3b 0d 09 | = frac.|v = 1;..|
|000008e0| 09 69 66 20 28 67 48 61 | 73 54 72 75 65 54 79 70 |.if (gHa|sTrueTyp|
|000008f0| 65 20 26 26 20 49 73 4f | 75 74 6c 69 6e 65 28 66 |e && IsO|utline(f|
|00000900| 72 61 63 2c 20 66 72 61 | 63 29 29 0d 09 09 7b 0d |rac, fra|c))...{.|
|00000910| 0d 09 09 09 2f 2a 0d 09 | 09 09 20 20 41 74 20 74 |..../*..|.. At t|
|00000920| 68 69 73 20 70 6f 69 6e | 74 20 77 65 20 6b 6e 6f |his poin|t we kno|
|00000930| 77 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 66 6f |w the cu|rrent fo|
|00000940| 6e 74 20 69 73 20 61 20 | 54 72 75 65 54 79 70 65 |nt is a |TrueType|
|00000950| 20 66 6f 6e 74 2c 20 73 | 6f 0d 09 09 09 20 20 77 | font, s|o.... w|
|00000960| 65 20 64 6f 20 61 6e 20 | 4f 75 74 6c 69 6e 65 4d |e do an |OutlineM|
|00000970| 65 74 72 69 63 73 20 63 | 61 6c 6c 20 77 69 74 68 |etrics c|all with|
|00000980| 20 6f 75 72 20 66 75 6c | 6c 20 74 65 78 74 2e 20 | our ful|l text. |
|00000990| 20 49 74 20 77 69 6c 6c | 20 70 75 74 0d 09 09 09 | It will| put....|
|000009a0| 20 20 74 68 65 20 74 61 | 6c 6c 65 73 74 20 63 68 | the ta|llest ch|
|000009b0| 61 72 61 63 74 65 72 20 | 61 73 63 65 6e 74 20 69 |aracter |ascent i|
|000009c0| 6e 74 6f 20 61 73 63 2c | 20 61 6e 64 20 74 68 65 |nto asc,| and the|
|000009d0| 20 64 65 65 70 65 73 74 | 20 64 65 73 63 65 6e 74 | deepest| descent|
|000009e0| 0d 09 09 09 20 20 69 6e | 74 6f 20 64 65 73 63 2e |.... in|to desc.|
|000009f0| 20 20 54 68 65 6e 20 77 | 65 20 63 68 6f 6f 73 65 | Then w|e choose|
|00000a00| 20 62 65 74 77 65 65 6e | 20 77 68 69 63 68 65 76 | between| whichev|
|00000a10| 65 72 27 73 20 6d 6f 73 | 74 20 62 65 74 77 65 65 |er's mos|t betwee|
|00000a20| 6e 0d 09 09 09 20 20 74 | 68 65 20 6f 6c 64 2d 73 |n.... t|he old-s|
|00000a30| 74 79 6c 65 20 61 73 63 | 65 6e 74 2f 64 65 73 63 |tyle asc|ent/desc|
|00000a40| 65 6e 74 20 61 6e 64 20 | 74 68 65 20 6e 75 6d 62 |ent and |the numb|
|00000a50| 65 72 73 20 77 65 20 67 | 65 74 20 66 72 6f 6d 0d |ers we g|et from.|
|00000a60| 09 09 09 20 20 74 68 65 | 20 4f 75 74 6c 69 6e 65 |... the| Outline|
|00000a70| 4d 65 74 72 69 63 73 20 | 63 61 6c 6c 2e 0d 09 09 |Metrics |call....|
|00000a80| 09 2a 2f 0d 0d 09 09 09 | 4f 75 74 6c 69 6e 65 4d |.*/.....|OutlineM|
|00000a90| 65 74 72 69 63 73 28 28 | 73 68 6f 72 74 29 74 65 |etrics((|short)te|
|00000aa0| 78 74 4c 65 6e 2c 20 74 | 68 65 54 65 78 74 2c 20 |xtLen, t|heText, |
|00000ab0| 66 72 61 63 2c 20 66 72 | 61 63 2c 20 26 61 73 63 |frac, fr|ac, &asc|
|00000ac0| 2c 20 26 64 65 73 63 2c | 20 6e 69 6c 2c 20 6e 69 |, &desc,| nil, ni|
|00000ad0| 6c 2c 20 6e 69 6c 29 3b | 0d 09 09 09 6c 69 6e 65 |l, nil);|....line|
|00000ae0| 48 65 69 67 68 74 20 3d | 20 4d 41 58 4f 46 28 66 |Height =| MAXOF(f|
|00000af0| 49 6e 66 6f 2e 61 73 63 | 65 6e 74 2c 20 61 73 63 |Info.asc|ent, asc|
|00000b00| 29 20 2b 20 4d 41 58 4f | 46 28 66 49 6e 66 6f 2e |) + MAXO|F(fInfo.|
|00000b10| 64 65 73 63 65 6e 74 2c | 20 2d 64 65 73 63 29 20 |descent,| -desc) |
|00000b20| 2b 20 66 49 6e 66 6f 2e | 6c 65 61 64 69 6e 67 3b |+ fInfo.|leading;|
|00000b30| 0d 09 09 09 2a 73 74 61 | 72 74 59 20 3d 20 77 72 |....*sta|rtY = wr|
|00000b40| 61 70 42 6f 78 2d 3e 74 | 6f 70 20 2b 20 4d 41 58 |apBox->t|op + MAX|
|00000b50| 4f 46 28 66 49 6e 66 6f | 2e 61 73 63 65 6e 74 2c |OF(fInfo|.ascent,|
|00000b60| 20 61 73 63 29 3b 0d 09 | 09 09 2a 73 74 61 72 74 | asc);..|..*start|
|00000b70| 59 20 2b 3d 20 66 49 6e | 66 6f 2e 6c 65 61 64 69 |Y += fIn|fo.leadi|
|00000b80| 6e 67 3b 0d 0d 09 09 7d | 0d 09 09 65 6c 73 65 0d |ng;....}|...else.|
|00000b90| 09 09 7b 0d 0d 09 09 09 | 2f 2a 0d 09 09 09 20 20 |..{.....|/*.... |
|00000ba0| 41 74 20 74 68 69 73 20 | 70 6f 69 6e 74 20 77 65 |At this |point we|
|00000bb0| 20 6b 6e 6f 77 20 74 68 | 65 20 63 75 72 72 65 6e | know th|e curren|
|00000bc0| 74 20 66 6f 6e 74 20 69 | 73 6e 27 74 20 54 72 75 |t font i|sn't Tru|
|00000bd0| 65 54 79 70 65 2c 20 73 | 6f 20 77 65 0d 09 09 09 |eType, s|o we....|
|00000be0| 20 20 6a 75 73 74 20 75 | 73 65 20 74 68 65 20 6f | just u|se the o|
|00000bf0| 6c 64 20 77 61 79 20 6f | 66 20 63 61 6c 63 75 6c |ld way o|f calcul|
|00000c00| 61 74 69 6e 67 20 6c 69 | 6e 65 20 68 65 69 67 68 |ating li|ne heigh|
|00000c10| 74 2e 0d 09 09 09 2a 2f | 0d 0d 09 09 09 6c 69 6e |t.....*/|.....lin|
|00000c20| 65 48 65 69 67 68 74 20 | 3d 20 66 49 6e 66 6f 2e |eHeight |= fInfo.|
|00000c30| 61 73 63 65 6e 74 20 2b | 20 66 49 6e 66 6f 2e 64 |ascent +| fInfo.d|
|00000c40| 65 73 63 65 6e 74 20 2b | 20 66 49 6e 66 6f 2e 6c |escent +| fInfo.l|
|00000c50| 65 61 64 69 6e 67 3b 0d | 09 09 09 2a 73 74 61 72 |eading;.|...*star|
|00000c60| 74 59 20 3d 20 77 72 61 | 70 42 6f 78 2d 3e 74 6f |tY = wra|pBox->to|
|00000c70| 70 20 2b 20 66 49 6e 66 | 6f 2e 61 73 63 65 6e 74 |p + fInf|o.ascent|
|00000c80| 20 2b 20 66 49 6e 66 6f | 2e 6c 65 61 64 69 6e 67 | + fInfo|.leading|
|00000c90| 3b 0d 09 09 7d 0d 0d 09 | 7d 0d 09 65 6c 73 65 20 |;...}...|}..else |
|00000ca0| 69 66 20 28 6c 68 43 6f | 64 65 20 3d 3d 20 30 29 |if (lhCo|de == 0)|
|00000cb0| 0d 09 7b 0d 0d 09 09 2f | 2a 0d 09 09 20 20 49 66 |..{..../|*... If|
|00000cc0| 20 74 68 65 20 75 73 65 | 72 20 68 61 73 20 73 70 | the use|r has sp|
|00000cd0| 65 63 69 66 69 65 64 20 | 22 64 65 66 61 75 6c 74 |ecified |"default|
|00000ce0| 22 20 6c 69 6e 65 20 68 | 65 69 67 68 74 2c 20 68 |" line h|eight, h|
|00000cf0| 65 20 6a 75 73 74 20 77 | 61 6e 74 73 20 75 73 0d |e just w|ants us.|
|00000d00| 09 09 20 20 74 6f 20 67 | 65 74 20 74 68 65 20 6c |.. to g|et the l|
|00000d10| 69 6e 65 20 68 65 69 67 | 68 74 20 66 72 6f 6d 20 |ine heig|ht from |
|00000d20| 74 68 65 20 46 6f 6e 74 | 49 6e 66 6f 20 72 65 63 |the Font|Info rec|
|00000d30| 6f 72 64 2e 0d 09 09 2a | 2f 0d 0d 09 09 6c 69 6e |ord....*|/....lin|
|00000d40| 65 48 65 69 67 68 74 20 | 3d 20 66 49 6e 66 6f 2e |eHeight |= fInfo.|
|00000d50| 61 73 63 65 6e 74 20 2b | 20 66 49 6e 66 6f 2e 64 |ascent +| fInfo.d|
|00000d60| 65 73 63 65 6e 74 20 2b | 20 66 49 6e 66 6f 2e 6c |escent +| fInfo.l|
|00000d70| 65 61 64 69 6e 67 3b 0d | 09 09 2a 73 74 61 72 74 |eading;.|..*start|
|00000d80| 59 20 3d 20 77 72 61 70 | 42 6f 78 2d 3e 74 6f 70 |Y = wrap|Box->top|
|00000d90| 20 2b 20 66 49 6e 66 6f | 2e 61 73 63 65 6e 74 20 | + fInfo|.ascent |
|00000da0| 2b 20 66 49 6e 66 6f 2e | 6c 65 61 64 69 6e 67 3b |+ fInfo.|leading;|
|00000db0| 0d 0d 09 7d 0d 09 65 6c | 73 65 0d 09 7b 0d 0d 09 |...}..el|se..{...|
|00000dc0| 09 2f 2a 20 49 66 20 74 | 68 65 20 75 73 65 72 20 |./* If t|he user |
|00000dd0| 68 61 73 20 70 72 6f 76 | 69 64 65 64 20 61 20 73 |has prov|ided a s|
|00000de0| 70 65 63 69 66 69 63 20 | 6c 69 6e 65 20 68 65 69 |pecific |line hei|
|00000df0| 67 68 74 2c 20 77 65 20 | 6a 75 73 74 20 74 72 75 |ght, we |just tru|
|00000e00| 73 74 0d 09 09 20 20 74 | 68 65 6d 2e 20 20 57 65 |st... t|hem. We|
|00000e10| 20 63 61 6e 27 74 20 72 | 65 61 6c 6c 79 20 67 65 | can't r|eally ge|
|00000e20| 6e 65 72 61 74 65 20 74 | 6f 6f 20 67 6f 6f 64 20 |nerate t|oo good |
|00000e30| 6f 66 20 61 20 73 74 61 | 72 74 69 6e 67 20 76 65 |of a sta|rting ve|
|00000e40| 72 74 69 63 61 6c 0d 09 | 09 20 20 63 6f 6f 72 64 |rtical..|. coord|
|00000e50| 69 6e 61 74 65 2c 20 62 | 75 74 20 77 65 20 6d 75 |inate, b|ut we mu|
|00000e60| 6e 67 65 20 6f 6e 65 20 | 74 6f 67 65 74 68 65 72 |nge one |together|
|00000e70| 20 61 6e 79 77 61 79 2e | 0d 09 09 2a 2f 0d 0d 09 | anyway.|...*/...|
|00000e80| 09 6c 69 6e 65 48 65 69 | 67 68 74 20 3d 20 6c 68 |.lineHei|ght = lh|
|00000e90| 43 6f 64 65 3b 0d 09 09 | 2a 73 74 61 72 74 59 20 |Code;...|*startY |
|00000ea0| 3d 20 77 72 61 70 42 6f | 78 2d 3e 74 6f 70 20 2b |= wrapBo|x->top +|
|00000eb0| 20 6c 68 43 6f 64 65 20 | 2b 20 66 49 6e 66 6f 2e | lhCode |+ fInfo.|
|00000ec0| 6c 65 61 64 69 6e 67 3b | 0d 0d 09 7d 0d 0d 09 72 |leading;|...}...r|
|00000ed0| 65 74 75 72 6e 20 28 6c | 69 6e 65 48 65 69 67 68 |eturn (l|ineHeigh|
|00000ee0| 74 29 3b 0d 7d 0d 0d 2f | 2a 2a 2a 2a 2a 2a 2a 2a |t);.}../|********|
|00000ef0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000f00| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000f10| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000f20| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000f30| 2a 2a 2a 2a 2a 2a 2a 2a | 0d 20 2a 0d 20 2a 20 4e |********|. *. * N|
|00000f40| 54 42 44 72 61 77 20 2d | 20 64 72 61 77 73 20 61 |TBDraw -| draws a|
|00000f50| 20 6c 69 6e 65 20 77 69 | 74 68 20 61 70 70 72 6f | line wi|th appro|
|00000f60| 70 72 69 61 74 65 20 6a | 75 73 74 69 66 69 63 61 |priate j|ustifica|
|00000f70| 74 69 6f 6e 0d 20 2a 0d | 20 2a 20 49 6e 70 75 74 |tion. *.| * Input|
|00000f80| 3a 09 62 72 65 61 6b 43 | 6f 64 65 09 74 68 65 20 |:.breakC|ode.the |
|00000f90| 62 72 65 61 6b 20 63 6f | 64 65 20 74 68 61 74 20 |break co|de that |
|00000fa0| 77 61 73 20 72 65 74 75 | 72 6e 65 64 20 66 72 6f |was retu|rned fro|
|00000fb0| 6d 20 53 74 79 6c 65 64 | 4c 69 6e 65 42 72 65 61 |m Styled|LineBrea|
|00000fc0| 6b 0d 20 2a 09 09 09 6c | 69 6e 65 53 74 61 72 74 |k. *...l|ineStart|
|00000fd0| 09 70 6f 69 6e 74 65 72 | 20 74 6f 20 74 68 65 20 |.pointer| to the |
|00000fe0| 62 65 67 69 6e 6e 69 6e | 67 20 6f 66 20 74 68 65 |beginnin|g of the|
|00000ff0| 20 74 65 78 74 20 66 6f | 72 20 74 68 65 20 63 75 | text fo|r the cu|
|00001000| 72 72 65 6e 74 20 6c 69 | 6e 65 0d 20 2a 09 09 09 |rrent li|ne. *...|
|00001010| 6c 69 6e 65 42 79 74 65 | 73 09 74 68 65 20 6c 65 |lineByte|s.the le|
|00001020| 6e 67 74 68 20 69 6e 20 | 62 79 74 65 73 20 6f 66 |ngth in |bytes of|
|00001030| 20 74 68 65 20 74 68 65 | 20 74 65 78 74 20 66 6f | the the| text fo|
|00001040| 72 20 74 68 69 73 20 6c | 69 6e 65 0d 20 2a 09 09 |r this l|ine. *..|
|00001050| 09 77 72 61 70 42 6f 78 | 09 09 74 68 65 20 62 6f |.wrapBox|..the bo|
|00001060| 78 20 77 69 74 68 69 6e | 20 77 68 69 63 68 20 77 |x within| which w|
|00001070| 65 27 72 65 20 77 72 61 | 70 70 69 6e 67 0d 20 2a |e're wra|pping. *|
|00001080| 09 09 09 61 6c 69 67 6e | 09 09 74 68 65 20 74 65 |...align|..the te|
|00001090| 78 74 20 61 6c 69 67 6e | 6d 65 6e 74 20 61 73 20 |xt align|ment as |
|000010a0| 73 70 65 63 69 66 69 65 | 64 20 62 79 20 74 68 65 |specifie|d by the|
|000010b0| 20 75 73 65 72 0d 20 2a | 09 09 09 63 75 72 59 09 | user. *|...curY.|
|000010c0| 09 6f 75 72 20 63 75 72 | 72 65 6e 74 20 76 65 72 |.our cur|rent ver|
|000010d0| 74 69 63 61 6c 20 70 65 | 6e 20 63 6f 6f 72 64 69 |tical pe|n coordi|
|000010e0| 6e 61 74 65 0d 20 2a 09 | 09 09 62 6f 78 57 69 64 |nate. *.|..boxWid|
|000010f0| 74 68 09 74 68 65 20 77 | 69 64 74 68 20 6f 66 20 |th.the w|idth of |
|00001100| 77 72 61 70 42 6f 78 20 | 28 73 69 6e 63 65 20 4e |wrapBox |(since N|
|00001110| 65 6f 54 65 78 74 42 6f | 78 20 61 6c 72 65 61 64 |eoTextBo|x alread|
|00001120| 79 20 63 61 6c 63 75 6c | 61 74 65 64 20 69 74 29 |y calcul|ated it)|
|00001130| 0d 20 2a 0d 20 2a 20 4f | 75 74 70 75 74 3a 09 6e |. *. * O|utput:.n|
|00001140| 6f 6e 65 20 28 64 72 61 | 77 73 20 6f 6e 20 74 68 |one (dra|ws on th|
|00001150| 65 20 73 63 72 65 65 6e | 29 0d 20 2a 09 09 09 0d |e screen|). *....|
|00001160| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001170| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001180| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001190| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000011a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000011b0| 2f 0d 76 6f 69 64 20 4e | 54 42 44 72 61 77 28 53 |/.void N|TBDraw(S|
|000011c0| 74 79 6c 65 64 4c 69 6e | 65 42 72 65 61 6b 43 6f |tyledLin|eBreakCo|
|000011d0| 64 65 20 62 72 65 61 6b | 43 6f 64 65 2c 0d 09 09 |de break|Code,...|
|000011e0| 09 20 75 6e 73 69 67 6e | 65 64 20 63 68 61 72 20 |. unsign|ed char |
|000011f0| 63 6f 6e 73 74 2a 20 6c | 69 6e 65 53 74 61 72 74 |const* l|ineStart|
|00001200| 2c 0d 09 09 09 20 6c 6f | 6e 67 20 6c 69 6e 65 42 |,.... lo|ng lineB|
|00001210| 79 74 65 73 2c 0d 09 09 | 09 20 63 6f 6e 73 74 20 |ytes,...|. const |
|00001220| 52 65 63 74 2a 20 77 72 | 61 70 42 6f 78 2c 0d 09 |Rect* wr|apBox,..|
|00001230| 09 09 20 73 68 6f 72 74 | 20 61 6c 69 67 6e 2c 0d |.. short| align,.|
|00001240| 09 09 09 20 73 68 6f 72 | 74 20 63 75 72 59 2c 0d |... shor|t curY,.|
|00001250| 09 09 09 20 73 68 6f 72 | 74 20 62 6f 78 57 69 64 |... shor|t boxWid|
|00001260| 74 68 29 0d 7b 0d 09 75 | 6e 73 69 67 6e 65 64 20 |th).{..u|nsigned |
|00001270| 6c 6f 6e 67 20 62 6c 61 | 63 6b 4c 65 6e 3b 09 09 |long bla|ckLen;..|
|00001280| 09 09 09 09 2f 2a 20 4c | 65 6e 67 74 68 20 6f 66 |..../* L|ength of|
|00001290| 20 6e 6f 6e 2d 77 68 69 | 74 65 20 63 68 61 72 61 | non-whi|te chara|
|000012a0| 63 74 65 72 73 20 2a 2f | 0d 09 73 68 6f 72 74 20 |cters */|..short |
|000012b0| 73 6c 6f 70 3b 09 09 09 | 09 09 09 09 09 09 2f 2a |slop;...|....../*|
|000012c0| 20 4e 75 6d 62 65 72 20 | 6f 66 20 70 69 78 65 6c | Number |of pixel|
|000012d0| 73 20 6f 66 20 73 6c 6f | 70 20 66 6f 72 20 66 75 |s of slo|p for fu|
|000012e0| 6c 6c 20 6a 75 73 74 20 | 2a 2f 0d 0d 09 2f 2a 0d |ll just |*/.../*.|
|000012f0| 09 20 20 54 68 65 20 66 | 69 72 73 74 20 74 68 69 |. The f|irst thi|
|00001300| 6e 67 20 77 65 20 64 6f | 20 68 65 72 65 20 69 73 |ng we do| here is|
|00001310| 20 64 65 74 65 72 6d 69 | 6e 65 20 74 68 65 20 6c | determi|ne the l|
|00001320| 65 6e 67 74 68 20 6f 66 | 20 74 68 65 20 22 62 6c |ength of| the "bl|
|00001330| 61 63 6b 22 20 70 61 72 | 74 0d 09 20 20 6f 66 20 |ack" par|t.. of |
|00001340| 74 68 65 20 63 75 72 72 | 65 6e 74 20 6c 69 6e 65 |the curr|ent line|
|00001350| 2e 20 20 54 68 69 73 20 | 65 78 63 6c 75 64 65 73 |. This |excludes|
|00001360| 20 73 70 61 63 65 73 2c | 20 63 61 72 72 69 61 67 | spaces,| carriag|
|00001370| 65 20 72 65 74 75 72 6e | 73 2c 20 61 6e 64 20 6f |e return|s, and o|
|00001380| 74 68 65 72 0d 09 20 20 | 77 68 69 74 65 20 73 74 |ther.. |white st|
|00001390| 75 66 66 20 64 65 70 65 | 6e 64 69 6e 67 20 6f 6e |uff depe|nding on|
|000013a0| 20 74 68 65 20 6c 61 6e | 67 75 61 67 65 2e 20 20 | the lan|guage. |
|000013b0| 48 6f 77 20 64 6f 20 77 | 65 20 6b 6e 6f 77 20 77 |How do w|e know w|
|000013c0| 68 61 74 20 74 6f 20 65 | 6c 69 6d 2d 0d 09 20 20 |hat to e|lim-.. |
|000013d0| 69 6e 61 74 65 3f 20 20 | 57 65 20 44 4f 4e 27 54 |inate? |We DON'T|
|000013e0| 21 20 20 53 6f 20 77 65 | 20 61 73 6b 20 6f 75 72 |! So we| ask our|
|000013f0| 20 66 72 69 65 6e 64 20 | 74 68 65 20 53 63 72 69 | friend |the Scri|
|00001400| 70 74 20 4d 61 6e 61 67 | 65 72 20 74 6f 20 64 6f |pt Manag|er to do|
|00001410| 20 69 74 0d 09 20 20 66 | 6f 72 20 75 73 2e 20 20 | it.. f|or us. |
|00001420| 56 69 73 69 62 6c 65 4c | 65 6e 67 74 68 20 72 65 |VisibleL|ength re|
|00001430| 74 75 72 6e 73 20 74 68 | 65 20 6e 75 6d 62 65 72 |turns th|e number|
|00001440| 20 6f 66 20 62 79 74 65 | 73 20 74 68 61 74 20 77 | of byte|s that w|
|00001450| 65 20 73 68 6f 75 6c 64 | 20 75 73 65 0d 09 20 20 |e should| use.. |
|00001460| 66 6f 72 20 70 69 78 65 | 6c 20 77 69 64 74 68 20 |for pixe|l width |
|00001470| 63 61 6c 63 75 6c 61 74 | 69 6f 6e 73 2e 0d 09 2a |calculat|ions...*|
|00001480| 2f 0d 0d 23 69 66 20 21 | 4e 75 4b 65 72 6e 65 6c |/..#if !|NuKernel|
|00001490| 42 75 69 6c 64 0d 09 62 | 6c 61 63 6b 4c 65 6e 20 |Build..b|lackLen |
|000014a0| 3d 20 56 69 73 69 62 6c | 65 4c 65 6e 67 74 68 28 |= Visibl|eLength(|
|000014b0| 28 50 74 72 29 6c 69 6e | 65 53 74 61 72 74 2c 20 |(Ptr)lin|eStart, |
|000014c0| 6c 69 6e 65 42 79 74 65 | 73 29 3b 0d 23 65 6c 73 |lineByte|s);.#els|
|000014d0| 65 0d 09 62 6c 61 63 6b | 4c 65 6e 20 3d 20 6c 69 |e..black|Len = li|
|000014e0| 6e 65 42 79 74 65 73 3b | 0d 23 65 6e 64 69 66 0d |neBytes;|.#endif.|
|000014f0| 0d 09 69 66 20 28 61 6c | 69 67 6e 20 3d 3d 20 6e |..if (al|ign == n|
|00001500| 74 62 4a 75 73 74 46 75 | 6c 6c 29 0d 09 7b 0d 0d |tbJustFu|ll)..{..|
|00001510| 09 09 2f 2a 0d 09 09 20 | 20 46 6f 72 20 66 75 6c |../*... | For ful|
|00001520| 6c 20 6a 75 73 74 69 66 | 69 63 61 74 69 6f 6e 2c |l justif|ication,|
|00001530| 20 77 65 20 6e 65 65 64 | 20 74 6f 20 63 61 6c 63 | we need| to calc|
|00001540| 75 6c 61 74 65 20 74 68 | 65 20 22 73 6c 6f 70 22 |ulate th|e "slop"|
|00001550| 20 73 70 61 63 65 20 6f | 6e 0d 09 09 20 20 74 68 | space o|n... th|
|00001560| 65 20 6c 69 6e 65 20 74 | 68 61 74 27 73 20 6e 6f |e line t|hat's no|
|00001570| 74 20 66 69 6c 6c 65 64 | 20 75 70 20 62 79 20 74 |t filled| up by t|
|00001580| 68 65 20 74 65 78 74 2e | 20 20 54 68 65 6e 20 77 |he text.| Then w|
|00001590| 65 20 6d 6f 76 65 20 74 | 6f 20 74 68 65 0d 09 09 |e move t|o the...|
|000015a0| 20 20 6d 61 72 67 69 6e | 20 61 6e 64 20 67 65 74 | margin| and get|
|000015b0| 20 72 65 61 64 79 20 74 | 6f 20 64 72 61 77 20 42 | ready t|o draw B|
|000015c0| 55 54 20 57 41 49 54 21 | 20 20 49 66 20 74 68 69 |UT WAIT!| If thi|
|000015d0| 73 20 69 73 20 74 68 65 | 20 6c 61 73 74 20 6c 69 |s is the| last li|
|000015e0| 6e 65 20 6f 66 0d 09 09 | 20 20 61 20 70 61 72 61 |ne of...| a para|
|000015f0| 67 72 61 70 68 2c 20 77 | 65 20 6e 65 65 64 20 74 |graph, w|e need t|
|00001600| 6f 20 64 72 61 77 20 69 | 74 20 77 69 74 68 20 77 |o draw i|t with w|
|00001610| 68 61 74 65 76 65 72 20 | 74 68 65 20 73 79 73 74 |hatever |the syst|
|00001620| 65 6d 20 6a 75 73 74 69 | 66 69 2d 0d 09 09 20 20 |em justi|fi-... |
|00001630| 63 61 74 69 6f 6e 20 69 | 73 2e 20 20 53 6f 20 69 |cation i|s. So i|
|00001640| 66 20 74 68 65 20 62 72 | 65 61 6b 20 63 6f 64 65 |f the br|eak code|
|00001650| 20 69 6e 64 69 63 61 74 | 65 73 20 77 65 27 72 65 | indicat|es we're|
|00001660| 20 61 74 20 74 68 65 20 | 65 6e 64 20 6f 66 20 74 | at the |end of t|
|00001670| 68 65 0d 09 09 20 20 74 | 65 78 74 2c 20 6f 72 20 |he... t|ext, or |
|00001680| 77 65 20 63 61 6e 20 66 | 69 6e 64 20 61 20 63 61 |we can f|ind a ca|
|00001690| 72 72 69 61 67 65 20 72 | 65 74 75 72 6e 20 74 68 |rriage r|eturn th|
|000016a0| 65 72 65 20 6f 75 72 73 | 65 6c 76 65 73 2c 20 77 |ere ours|elves, w|
|000016b0| 65 20 6a 75 73 74 0d 09 | 09 20 20 63 68 61 6e 67 |e just..|. chang|
|000016c0| 65 20 74 68 65 20 74 65 | 78 74 20 61 6c 69 67 6e |e the te|xt align|
|000016d0| 6d 65 6e 74 20 74 6f 20 | 74 68 65 20 63 75 72 72 |ment to |the curr|
|000016e0| 65 6e 74 20 64 65 66 61 | 75 6c 74 20 73 79 73 74 |ent defa|ult syst|
|000016f0| 65 6d 20 74 65 78 74 20 | 61 6c 69 67 6e 2d 0d 09 |em text |align-..|
|00001700| 09 20 20 6d 65 6e 74 20 | 61 6e 64 20 66 61 6c 6c |. ment |and fall|
|00001710| 20 74 68 72 6f 75 67 68 | 20 77 69 74 68 6f 75 74 | through| without|
|00001720| 20 64 72 61 77 69 6e 67 | 2e 20 20 49 66 20 69 74 | drawing|. If it|
|00001730| 27 73 20 6a 75 73 74 20 | 61 6e 6f 74 68 65 72 20 |'s just |another |
|00001740| 6c 69 6e 65 0d 09 09 20 | 20 77 69 74 68 69 6e 20 |line... | within |
|00001750| 61 20 70 61 72 61 67 72 | 61 70 68 2c 20 77 65 20 |a paragr|aph, we |
|00001760| 75 73 65 20 74 68 65 20 | 68 61 6e 64 79 20 53 63 |use the |handy Sc|
|00001770| 72 69 70 74 20 4d 61 6e | 61 67 65 72 20 72 6f 75 |ript Man|ager rou|
|00001780| 74 69 6e 65 20 44 72 61 | 77 4a 75 73 74 0d 09 09 |tine Dra|wJust...|
|00001790| 20 20 74 6f 20 64 72 61 | 77 20 69 74 20 6a 75 73 | to dra|w it jus|
|000017a0| 74 69 66 69 65 64 2e 20 | 20 49 6e 20 6c 61 6e 67 |tified. | In lang|
|000017b0| 75 61 67 65 73 20 6c 69 | 6b 65 20 41 72 61 62 69 |uages li|ke Arabi|
|000017c0| 63 2c 20 66 75 6c 6c 20 | 6a 75 73 74 69 66 69 63 |c, full |justific|
|000017d0| 61 74 69 6f 6e 0d 09 09 | 20 20 69 73 20 70 65 72 |ation...| is per|
|000017e0| 66 6f 72 6d 65 64 20 64 | 69 66 66 65 72 65 6e 74 |formed d|ifferent|
|000017f0| 6c 79 20 74 68 61 6e 20 | 6a 75 73 74 20 73 70 61 |ly than |just spa|
|00001800| 63 69 6e 67 20 6f 75 74 | 20 74 68 65 20 77 6f 72 |cing out| the wor|
|00001810| 64 73 2e 20 20 44 72 61 | 77 4a 75 73 74 0d 09 09 |ds. Dra|wJust...|
|00001820| 20 20 68 61 6e 64 6c 65 | 73 20 63 61 73 65 73 20 | handle|s cases |
|00001830| 6c 69 6b 65 20 74 68 65 | 73 65 20 63 6f 72 72 65 |like the|se corre|
|00001840| 63 74 6c 79 2e 0d 0d 09 | 09 20 20 4e 6f 74 65 20 |ctly....|. Note |
|00001850| 74 68 61 74 20 77 68 65 | 6e 20 77 65 20 67 6f 20 |that whe|n we go |
|00001860| 6c 6f 6f 6b 69 6e 67 20 | 66 6f 72 20 74 68 65 20 |looking |for the |
|00001870| 63 61 72 72 69 61 67 65 | 20 72 65 74 75 72 6e 20 |carriage| return |
|00001880| 61 74 20 74 68 65 20 65 | 6e 64 20 6f 66 0d 09 09 |at the e|nd of...|
|00001890| 20 20 74 68 65 20 6c 69 | 6e 65 2c 20 69 74 27 73 | the li|ne, it's|
|000018a0| 20 6f 6b 61 79 20 74 6f | 20 73 69 6d 70 6c 79 20 | okay to| simply |
|000018b0| 69 6e 64 65 78 20 74 6f | 20 74 68 65 20 6c 61 73 |index to| the las|
|000018c0| 74 20 62 79 74 65 20 6f | 66 20 74 68 65 20 73 74 |t byte o|f the st|
|000018d0| 72 69 6e 67 2e 0d 09 09 | 20 20 54 68 69 73 20 69 |ring....| This i|
|000018e0| 73 20 62 65 63 61 75 73 | 65 20 74 68 65 20 63 61 |s becaus|e the ca|
|000018f0| 72 72 69 61 67 65 20 72 | 65 74 75 72 6e 20 63 68 |rriage r|eturn ch|
|00001900| 61 72 61 63 74 65 72 2c | 20 30 78 30 64 2c 20 69 |aracter,| 0x0d, i|
|00001910| 73 20 69 6e 20 74 68 65 | 0d 09 09 20 20 63 6f 6e |s in the|... con|
|00001920| 74 72 6f 6c 2d 63 6f 64 | 65 20 72 61 6e 67 65 2c |trol-cod|e range,|
|00001930| 20 77 68 69 63 68 20 69 | 73 20 64 65 66 69 6e 65 | which i|s define|
|00001940| 64 20 74 6f 20 6e 65 76 | 65 72 20 62 65 20 74 68 |d to nev|er be th|
|00001950| 65 20 6c 6f 77 20 62 79 | 74 65 20 6f 66 20 61 0d |e low by|te of a.|
|00001960| 09 09 20 20 74 77 6f 20 | 62 79 74 65 20 63 68 61 |.. two |byte cha|
|00001970| 72 61 63 74 65 72 2e 0d | 09 09 2a 2f 0d 0d 09 09 |racter..|..*/....|
|00001980| 73 6c 6f 70 20 3d 20 62 | 6f 78 57 69 64 74 68 20 |slop = b|oxWidth |
|00001990| 2d 20 54 65 78 74 57 69 | 64 74 68 28 6c 69 6e 65 |- TextWi|dth(line|
|000019a0| 53 74 61 72 74 2c 20 30 | 2c 20 62 6c 61 63 6b 4c |Start, 0|, blackL|
|000019b0| 65 6e 29 3b 0d 09 09 4d | 6f 76 65 54 6f 28 77 72 |en);...M|oveTo(wr|
|000019c0| 61 70 42 6f 78 2d 3e 6c | 65 66 74 2c 20 63 75 72 |apBox->l|eft, cur|
|000019d0| 59 29 3b 0d 09 09 69 66 | 20 28 62 72 65 61 6b 43 |Y);...if| (breakC|
|000019e0| 6f 64 65 20 3d 3d 20 73 | 6d 42 72 65 61 6b 4f 76 |ode == s|mBreakOv|
|000019f0| 65 72 66 6c 6f 77 20 7c | 7c 20 2a 28 6c 69 6e 65 |erflow ||| *(line|
|00001a00| 53 74 61 72 74 20 2b 20 | 28 6c 69 6e 65 42 79 74 |Start + |(lineByt|
|00001a10| 65 73 20 2d 20 31 29 29 | 20 3d 3d 20 6b 52 65 74 |es - 1))| == kRet|
|00001a20| 75 72 6e 43 68 61 72 29 | 0d 09 09 09 61 6c 69 67 |urnChar)|....alig|
|00001a30| 6e 20 3d 20 47 65 74 53 | 79 73 44 69 72 65 63 74 |n = GetS|ysDirect|
|00001a40| 69 6f 6e 28 29 3b 0d 09 | 09 65 6c 73 65 0d 09 09 |ion();..|.else...|
|00001a50| 09 44 72 61 77 4a 75 73 | 74 28 28 50 74 72 29 6c |.DrawJus|t((Ptr)l|
|00001a60| 69 6e 65 53 74 61 72 74 | 2c 20 62 6c 61 63 6b 4c |ineStart|, blackL|
|00001a70| 65 6e 2c 20 73 6c 6f 70 | 29 3b 0d 09 7d 0d 0d 09 |en, slop|);..}...|
|00001a80| 2f 2a 0d 09 20 20 46 6f | 72 20 74 68 65 20 72 65 |/*.. Fo|r the re|
|00001a90| 73 74 20 6f 66 20 74 68 | 65 20 74 65 78 74 20 61 |st of th|e text a|
|00001aa0| 6c 69 67 6e 6d 65 6e 74 | 73 20 28 6c 65 66 74 2c |lignment|s (left,|
|00001ab0| 20 63 65 6e 74 65 72 2c | 20 61 6e 64 20 72 69 67 | center,| and rig|
|00001ac0| 68 74 29 2c 20 77 65 20 | 6a 75 73 74 0d 09 20 20 |ht), we |just.. |
|00001ad0| 6d 6f 76 65 20 74 68 65 | 20 70 65 6e 20 74 6f 20 |move the| pen to |
|00001ae0| 74 68 65 20 72 69 67 68 | 74 20 70 6c 61 63 65 20 |the righ|t place |
|00001af0| 61 6e 64 20 64 72 61 77 | 20 74 68 65 20 74 65 78 |and draw| the tex|
|00001b00| 74 20 77 69 74 68 20 44 | 72 61 77 54 65 78 74 2e |t with D|rawText.|
|00001b10| 20 20 4e 6f 74 65 0d 09 | 20 20 74 68 61 74 20 74 | Note..| that t|
|00001b20| 68 65 20 61 6c 69 67 6e | 6d 65 6e 74 73 20 74 68 |he align|ments th|
|00001b30| 61 74 20 63 6f 75 6c 64 | 20 68 61 76 65 20 63 6f |at could| have co|
|00001b40| 6d 65 20 69 6e 74 6f 20 | 74 68 65 20 4e 65 6f 54 |me into |the NeoT|
|00001b50| 65 78 74 42 6f 78 20 63 | 61 6c 6c 20 68 61 76 65 |extBox c|all have|
|00001b60| 0d 09 20 20 62 65 65 6e | 20 72 65 73 6f 76 65 64 |.. been| resoved|
|00001b70| 20 64 6f 77 6e 20 74 6f | 20 6f 6e 65 20 6f 66 20 | down to| one of |
|00001b80| 74 68 65 20 66 6f 75 72 | 20 63 6f 6e 73 74 61 6e |the four| constan|
|00001b90| 74 73 20 74 65 46 6f 72 | 63 65 4c 65 66 74 2c 20 |ts teFor|ceLeft, |
|00001ba0| 74 65 4a 75 73 74 52 69 | 67 68 74 0d 09 20 20 74 |teJustRi|ght.. t|
|00001bb0| 65 4a 75 73 74 43 65 6e | 74 65 72 2c 20 6f 72 20 |eJustCen|ter, or |
|00001bc0| 6e 74 62 4a 75 73 74 46 | 75 6c 6c 2e 0d 09 2a 2f |ntbJustF|ull...*/|
|00001bd0| 0d 0d 09 73 77 69 74 63 | 68 20 28 61 6c 69 67 6e |...switc|h (align|
|00001be0| 29 0d 09 7b 0d 09 09 63 | 61 73 65 20 74 65 46 6f |)..{...c|ase teFo|
|00001bf0| 72 63 65 4c 65 66 74 3a | 0d 09 09 63 61 73 65 20 |rceLeft:|...case |
|00001c00| 74 65 4a 75 73 74 4c 65 | 66 74 3a 0d 09 09 09 4d |teJustLe|ft:....M|
|00001c10| 6f 76 65 54 6f 28 77 72 | 61 70 42 6f 78 2d 3e 6c |oveTo(wr|apBox->l|
|00001c20| 65 66 74 2c 20 63 75 72 | 59 29 3b 0d 09 09 09 62 |eft, cur|Y);....b|
|00001c30| 72 65 61 6b 3b 0d 09 09 | 63 61 73 65 20 74 65 4a |reak;...|case teJ|
|00001c40| 75 73 74 52 69 67 68 74 | 3a 0d 09 09 09 4d 6f 76 |ustRight|:....Mov|
|00001c50| 65 54 6f 28 77 72 61 70 | 42 6f 78 2d 3e 72 69 67 |eTo(wrap|Box->rig|
|00001c60| 68 74 20 2d 20 54 65 78 | 74 57 69 64 74 68 28 6c |ht - Tex|tWidth(l|
|00001c70| 69 6e 65 53 74 61 72 74 | 2c 20 30 2c 20 62 6c 61 |ineStart|, 0, bla|
|00001c80| 63 6b 4c 65 6e 29 2c 20 | 63 75 72 59 29 3b 0d 09 |ckLen), |curY);..|
|00001c90| 09 09 62 72 65 61 6b 3b | 0d 09 09 63 61 73 65 20 |..break;|...case |
|00001ca0| 74 65 4a 75 73 74 43 65 | 6e 74 65 72 3a 0d 09 09 |teJustCe|nter:...|
|00001cb0| 09 4d 6f 76 65 54 6f 28 | 77 72 61 70 42 6f 78 2d |.MoveTo(|wrapBox-|
|00001cc0| 3e 6c 65 66 74 20 2b 20 | 28 62 6f 78 57 69 64 74 |>left + |(boxWidt|
|00001cd0| 68 20 2d 20 54 65 78 74 | 57 69 64 74 68 28 6c 69 |h - Text|Width(li|
|00001ce0| 6e 65 53 74 61 72 74 2c | 20 30 2c 20 62 6c 61 63 |neStart,| 0, blac|
|00001cf0| 6b 4c 65 6e 29 29 20 2f | 20 32 2c 20 63 75 72 59 |kLen)) /| 2, curY|
|00001d00| 29 3b 0d 09 09 09 62 72 | 65 61 6b 3b 0d 09 7d 0d |);....br|eak;..}.|
|00001d10| 09 69 66 20 28 61 6c 69 | 67 6e 20 21 3d 20 6e 74 |.if (ali|gn != nt|
|00001d20| 62 4a 75 73 74 46 75 6c | 6c 29 0d 09 09 44 72 61 |bJustFul|l)...Dra|
|00001d30| 77 54 65 78 74 28 6c 69 | 6e 65 53 74 61 72 74 2c |wText(li|neStart,|
|00001d40| 20 30 2c 20 6c 69 6e 65 | 42 79 74 65 73 29 3b 0d | 0, line|Bytes);.|
|00001d50| 7d 0d 0d 2f 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |}../****|********|
|00001d60| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001d70| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001d80| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001d90| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00001da0| 2a 2a 2a 2a 0d 20 2a 0d | 20 2a 20 4e 65 6f 54 65 |****. *.| * NeoTe|
|00001db0| 78 74 42 6f 78 20 2d 20 | 77 6f 72 64 2d 77 72 61 |xtBox - |word-wra|
|00001dc0| 70 73 20 74 65 78 74 20 | 69 6e 73 69 64 65 20 61 |ps text |inside a|
|00001dd0| 20 67 69 76 65 6e 20 62 | 6f 78 0d 20 2a 0d 20 2a | given b|ox. *. *|
|00001de0| 20 49 6e 70 75 74 3a 09 | 74 68 65 54 65 78 74 09 | Input:.|theText.|
|00001df0| 09 74 68 65 20 74 65 78 | 74 20 77 65 20 6e 65 65 |.the tex|t we nee|
|00001e00| 64 20 74 6f 20 77 72 61 | 70 0d 20 2a 09 09 09 74 |d to wra|p. *...t|
|00001e10| 65 78 74 4c 65 6e 09 09 | 74 68 65 20 6c 65 6e 67 |extLen..|the leng|
|00001e20| 74 68 20 69 6e 20 62 79 | 74 65 73 20 6f 66 20 74 |th in by|tes of t|
|00001e30| 68 65 20 74 65 78 74 0d | 20 2a 09 09 09 77 72 61 |he text.| *...wra|
|00001e40| 70 42 6f 78 09 09 74 68 | 65 20 62 6f 78 20 77 69 |pBox..th|e box wi|
|00001e50| 74 68 69 6e 20 77 68 69 | 63 68 20 77 65 27 72 65 |thin whi|ch we're|
|00001e60| 20 77 72 61 70 70 69 6e | 67 0d 20 2a 09 09 09 61 | wrappin|g. *...a|
|00001e70| 6c 69 67 6e 09 09 74 68 | 65 20 74 65 78 74 20 61 |lign..th|e text a|
|00001e80| 6c 69 67 6e 6d 65 6e 74 | 0d 20 2a 09 09 09 09 09 |lignment|. *.....|
|00001e90| 09 09 74 65 46 6f 72 63 | 65 4c 65 66 74 2c 20 74 |..teForc|eLeft, t|
|00001ea0| 65 46 6c 75 73 68 4c 65 | 66 74 09 6c 65 66 74 20 |eFlushLe|ft.left |
|00001eb0| 6a 75 73 74 69 66 69 65 | 64 0d 20 2a 09 09 09 09 |justifie|d. *....|
|00001ec0| 09 09 09 74 65 4a 75 73 | 74 43 65 6e 74 65 72 2c |...teJus|tCenter,|
|00001ed0| 20 74 65 43 65 6e 74 65 | 72 09 09 63 65 6e 74 65 | teCente|r..cente|
|00001ee0| 72 20 6a 75 73 74 69 66 | 69 65 64 0d 20 2a 09 09 |r justif|ied. *..|
|00001ef0| 09 09 09 09 09 74 65 4a | 75 73 74 52 69 67 68 74 |.....teJ|ustRight|
|00001f00| 2c 20 74 65 46 6c 75 73 | 68 52 69 67 68 74 09 72 |, teFlus|hRight.r|
|00001f10| 69 67 68 74 20 6a 75 73 | 74 69 66 69 65 64 0d 20 |ight jus|tified. |
|00001f20| 2a 09 09 09 09 09 09 09 | 6e 74 62 4a 75 73 74 46 |*.......|ntbJustF|
|00001f30| 75 6c 6c 09 09 09 09 09 | 66 75 6c 6c 20 6a 75 73 |ull.....|full jus|
|00001f40| 74 69 66 69 65 64 0d 20 | 2a 09 09 09 09 09 09 09 |tified. |*.......|
|00001f50| 74 65 4a 75 73 74 4c 65 | 66 74 2c 20 74 65 46 6c |teJustLe|ft, teFl|
|00001f60| 75 73 68 44 65 66 61 75 | 6c 74 09 73 79 73 74 65 |ushDefau|lt.syste|
|00001f70| 6d 20 6a 75 73 74 69 66 | 69 65 64 0d 20 2a 09 09 |m justif|ied. *..|
|00001f80| 09 6c 68 43 6f 64 65 09 | 09 74 68 65 20 6c 69 6e |.lhCode.|.the lin|
|00001f90| 65 20 68 65 69 67 68 74 | 20 63 6f 64 65 20 74 68 |e height| code th|
|00001fa0| 61 74 20 77 61 73 20 70 | 61 73 73 65 64 20 74 6f |at was p|assed to|
|00001fb0| 20 4e 65 6f 54 65 78 74 | 42 6f 78 0d 20 2a 09 09 | NeoText|Box. *..|
|00001fc0| 09 09 09 09 09 3c 20 30 | 09 09 76 61 72 69 61 62 |.....< 0|..variab|
|00001fd0| 6c 65 20 2d 20 62 61 73 | 65 64 20 6f 6e 20 74 61 |le - bas|ed on ta|
|00001fe0| 6c 6c 65 73 74 20 63 68 | 61 72 61 63 74 65 72 0d |llest ch|aracter.|
|00001ff0| 20 2a 09 09 09 09 09 09 | 09 30 09 09 64 65 66 61 | *......|.0..defa|
|00002000| 75 6c 74 20 2d 20 62 61 | 73 65 64 20 6f 6e 20 47 |ult - ba|sed on G|
|00002010| 65 74 46 6f 6e 74 49 6e | 66 6f 0d 20 2a 09 09 09 |etFontIn|fo. *...|
|00002020| 09 09 09 09 3e 20 30 09 | 09 66 69 78 65 64 20 2d |....> 0.|.fixed -|
|00002030| 20 75 73 65 20 6c 68 43 | 6f 64 65 20 61 73 20 74 | use lhC|ode as t|
|00002040| 68 65 20 6c 69 6e 65 20 | 68 65 69 67 68 74 0d 20 |he line |height. |
|00002050| 2a 09 09 09 65 6e 64 59 | 09 09 56 41 52 20 2d 20 |*...endY|..VAR - |
|00002060| 69 66 20 6e 6f 6e 2d 6e | 69 6c 2c 20 74 68 65 20 |if non-n|il, the |
|00002070| 76 65 72 74 69 63 61 6c | 20 63 6f 6f 72 64 20 6f |vertical| coord o|
|00002080| 66 20 74 68 65 20 6c 61 | 73 74 20 6c 69 6e 65 0d |f the la|st line.|
|00002090| 20 2a 09 09 09 6c 68 55 | 73 65 64 09 09 56 41 52 | *...lhU|sed..VAR|
|000020a0| 20 2d 20 69 66 20 6e 6f | 6e 2d 6e 69 6c 2c 20 74 | - if no|n-nil, t|
|000020b0| 68 65 20 6c 69 6e 65 20 | 68 65 69 67 68 74 20 75 |he line |height u|
|000020c0| 73 65 64 20 74 6f 20 64 | 72 61 77 20 74 68 65 20 |sed to d|raw the |
|000020d0| 74 65 78 74 0d 20 2a 0d | 20 2a 20 4f 75 74 70 75 |text. *.| * Outpu|
|000020e0| 74 3a 09 72 65 74 75 72 | 6e 73 20 74 68 65 20 6e |t:.retur|ns the n|
|000020f0| 75 6d 62 65 72 20 6f 66 | 20 6c 69 6e 65 20 64 72 |umber of| line dr|
|00002100| 61 77 6e 20 74 6f 74 61 | 6c 20 28 65 76 65 6e 20 |awn tota|l (even |
|00002110| 69 66 20 74 68 65 79 20 | 64 72 65 77 20 6f 75 74 |if they |drew out|
|00002120| 73 69 64 65 20 6f 66 0d | 20 2a 09 09 09 74 68 65 |side of.| *...the|
|00002130| 20 62 6f 75 6e 64 72 69 | 65 73 20 6f 66 20 77 72 | boundri|es of wr|
|00002140| 61 70 42 6f 78 29 0d 20 | 2a 09 09 09 0d 2a 2a 2a |apBox). |*....***|
|00002150| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00002160| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00002170| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00002180| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00002190| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2f 0d 73 |********|*****/.s|
|000021a0| 68 6f 72 74 20 4e 65 6f | 54 65 78 74 42 6f 78 28 |hort Neo|TextBox(|
|000021b0| 75 6e 73 69 67 6e 65 64 | 20 63 68 61 72 20 63 6f |unsigned| char co|
|000021c0| 6e 73 74 2a 20 74 68 65 | 54 65 78 74 2c 0d 09 09 |nst* the|Text,...|
|000021d0| 09 09 20 75 6e 73 69 67 | 6e 65 64 20 6c 6f 6e 67 |.. unsig|ned long|
|000021e0| 20 74 65 78 74 4c 65 6e | 2c 0d 09 09 09 09 20 63 | textLen|,..... c|
|000021f0| 6f 6e 73 74 20 52 65 63 | 74 2a 20 77 72 61 70 42 |onst Rec|t* wrapB|
|00002200| 6f 78 2c 0d 09 09 09 09 | 20 73 68 6f 72 74 20 61 |ox,.....| short a|
|00002210| 6c 69 67 6e 2c 0d 09 09 | 09 09 20 73 68 6f 72 74 |lign,...|.. short|
|00002220| 20 6c 68 43 6f 64 65 2c | 0d 09 09 09 09 20 73 68 | lhCode,|..... sh|
|00002230| 6f 72 74 2a 20 65 6e 64 | 59 2c 0d 09 09 09 09 20 |ort* end|Y,..... |
|00002240| 73 68 6f 72 74 2a 20 6c | 68 55 73 65 64 29 0d 7b |short* l|hUsed).{|
|00002250| 0d 09 52 67 6e 48 61 6e | 64 6c 65 20 6f 6c 64 43 |..RgnHan|dle oldC|
|00002260| 6c 69 70 3b 09 09 09 09 | 09 09 09 2f 2a 20 53 61 |lip;....|.../* Sa|
|00002270| 76 65 64 20 63 6c 69 70 | 70 69 6e 67 20 72 65 67 |ved clip|ping reg|
|00002280| 69 6f 6e 20 2a 2f 0d 09 | 53 74 79 6c 65 64 4c 69 |ion */..|StyledLi|
|00002290| 6e 65 42 72 65 61 6b 43 | 6f 64 65 20 62 72 65 61 |neBreakC|ode brea|
|000022a0| 6b 43 6f 64 65 3b 09 09 | 09 09 2f 2a 20 52 65 74 |kCode;..|../* Ret|
|000022b0| 75 72 6e 65 64 20 63 6f | 64 65 20 66 72 6f 6d 20 |urned co|de from |
|000022c0| 53 74 79 6c 65 64 4c 69 | 6e 65 42 72 65 61 6b 20 |StyledLi|neBreak |
|000022d0| 2a 2f 0d 09 46 69 78 65 | 64 20 66 69 78 65 64 4d |*/..Fixe|d fixedM|
|000022e0| 61 78 3b 09 09 09 09 09 | 09 09 09 2f 2a 20 62 6f |ax;.....|.../* bo|
|000022f0| 78 57 69 64 74 68 20 63 | 6f 6e 76 65 72 74 65 64 |xWidth c|onverted|
|00002300| 20 74 6f 20 66 69 78 65 | 64 20 70 6f 69 6e 74 20 | to fixe|d point |
|00002310| 2a 2f 0d 09 46 69 78 65 | 64 20 77 72 61 70 57 69 |*/..Fixe|d wrapWi|
|00002320| 64 3b 09 09 09 09 09 09 | 09 09 2f 2a 20 57 69 64 |d;......|../* Wid|
|00002330| 74 68 20 74 6f 20 77 72 | 61 70 20 74 6f 20 2a 2f |th to wr|ap to */|
|00002340| 0d 09 73 68 6f 72 74 20 | 62 6f 78 57 69 64 74 68 |..short |boxWidth|
|00002350| 3b 09 09 09 09 09 09 09 | 09 2f 2a 20 57 69 64 74 |;.......|./* Widt|
|00002360| 68 20 6f 66 20 74 68 65 | 20 77 72 61 70 42 6f 78 |h of the| wrapBox|
|00002370| 20 2a 2f 0d 09 6c 6f 6e | 67 20 6c 69 6e 65 42 79 | */..lon|g lineBy|
|00002380| 74 65 73 3b 09 09 09 09 | 09 09 09 09 2f 2a 20 4e |tes;....|..../* N|
|00002390| 75 6d 62 65 72 20 6f 66 | 20 62 79 74 65 73 20 69 |umber of| bytes i|
|000023a0| 6e 20 6f 6e 65 20 6c 69 | 6e 65 20 2a 2f 0d 09 75 |n one li|ne */..u|
|000023b0| 6e 73 69 67 6e 65 64 20 | 73 68 6f 72 74 20 6c 69 |nsigned |short li|
|000023c0| 6e 65 48 65 69 67 68 74 | 3b 09 09 09 09 09 2f 2a |neHeight|;...../*|
|000023d0| 20 43 61 6c 63 75 6c 61 | 74 65 64 20 6c 69 6e 65 | Calcula|ted line|
|000023e0| 20 68 65 69 67 68 74 20 | 2a 2f 0d 09 73 68 6f 72 | height |*/..shor|
|000023f0| 74 20 63 75 72 59 3b 09 | 09 09 09 09 09 09 09 09 |t curY;.|........|
|00002400| 2f 2a 20 43 75 72 72 65 | 6e 74 20 76 65 72 74 69 |/* Curre|nt verti|
|00002410| 63 61 6c 20 70 65 6e 20 | 6c 6f 63 61 74 69 6f 6e |cal pen |location|
|00002420| 20 2a 2f 0d 09 75 6e 73 | 69 67 6e 65 64 20 73 68 | */..uns|igned sh|
|00002430| 6f 72 74 20 6c 69 6e 65 | 43 6f 75 6e 74 3b 09 09 |ort line|Count;..|
|00002440| 09 09 09 2f 2a 20 4e 75 | 6d 62 65 72 20 6f 66 20 |.../* Nu|mber of |
|00002450| 6c 69 6e 65 73 20 77 65 | 27 76 65 20 64 72 61 77 |lines we|'ve draw|
|00002460| 6e 20 2a 2f 0d 09 6c 6f | 6e 67 20 74 65 78 74 4c |n */..lo|ng textL|
|00002470| 65 66 74 3b 09 09 09 09 | 09 09 09 09 2f 2a 20 50 |eft;....|..../* P|
|00002480| 6f 69 6e 74 65 72 20 74 | 6f 20 72 65 6d 61 69 6e |ointer t|o remain|
|00002490| 69 6e 67 20 62 79 74 65 | 73 20 6f 66 20 74 65 78 |ing byte|s of tex|
|000024a0| 74 20 2a 2f 0d 09 75 6e | 73 69 67 6e 65 64 20 63 |t */..un|signed c|
|000024b0| 68 61 72 20 63 6f 6e 73 | 74 2a 20 6c 69 6e 65 53 |har cons|t* lineS|
|000024c0| 74 61 72 74 3b 09 09 09 | 09 2f 2a 20 50 6f 69 6e |tart;...|./* Poin|
|000024d0| 74 65 72 20 74 6f 20 62 | 65 67 69 6e 6e 69 6e 67 |ter to b|eginning|
|000024e0| 20 6f 66 20 61 20 6c 69 | 6e 65 20 2a 2f 0d 09 75 | of a li|ne */..u|
|000024f0| 6e 73 69 67 6e 65 64 20 | 63 68 61 72 20 63 6f 6e |nsigned |char con|
|00002500| 73 74 2a 20 74 65 78 74 | 45 6e 64 3b 09 09 09 09 |st* text|End;....|
|00002510| 2f 2a 20 50 6f 69 6e 74 | 65 72 20 74 6f 20 74 68 |/* Point|er to th|
|00002520| 65 20 65 6e 64 20 6f 66 | 20 69 6e 70 75 74 20 74 |e end of| input t|
|00002530| 65 78 74 20 2a 2f 0d 0d | 09 2f 2a 0d 09 20 20 46 |ext */..|./*.. F|
|00002540| 69 72 73 74 2c 20 77 65 | 20 73 61 76 65 20 74 68 |irst, we| save th|
|00002550| 65 20 6f 6c 64 20 63 6c | 69 70 70 69 6e 67 20 72 |e old cl|ipping r|
|00002560| 65 67 69 6f 6e 20 61 6e | 64 20 63 6c 69 70 20 74 |egion an|d clip t|
|00002570| 6f 20 77 72 61 70 42 6f | 78 2e 20 20 54 68 65 6e |o wrapBo|x. Then|
|00002580| 2c 20 66 69 67 75 72 65 | 0d 09 20 20 74 68 65 20 |, figure|.. the |
|00002590| 77 69 64 74 68 20 6f 66 | 20 77 72 61 70 42 6f 78 |width of| wrapBox|
|000025a0| 2c 20 61 6e 64 20 6d 61 | 6b 65 20 61 20 66 69 78 |, and ma|ke a fix|
|000025b0| 65 64 20 70 6f 69 6e 74 | 20 76 65 72 73 69 6f 6e |ed point| version|
|000025c0| 20 6f 66 20 69 74 2e 20 | 20 41 6c 73 6f 2c 20 72 | of it. | Also, r|
|000025d0| 65 73 6f 6c 76 65 0d 09 | 20 20 74 68 65 20 74 65 |esolve..| the te|
|000025e0| 78 74 20 61 6c 69 67 6e | 6d 65 6e 74 20 74 65 46 |xt align|ment teF|
|000025f0| 6c 75 73 68 44 65 66 61 | 75 6c 74 20 74 6f 20 62 |lushDefa|ult to b|
|00002600| 65 20 74 68 65 20 64 65 | 66 61 75 6c 74 20 73 79 |e the de|fault sy|
|00002610| 73 74 65 6d 20 74 65 78 | 74 20 61 6c 69 67 6e 6d |stem tex|t alignm|
|00002620| 65 6e 74 2e 0d 09 2a 2f | 0d 0d 09 47 65 74 43 6c |ent...*/|...GetCl|
|00002630| 69 70 28 28 6f 6c 64 43 | 6c 69 70 20 3d 20 4e 65 |ip((oldC|lip = Ne|
|00002640| 77 52 67 6e 28 29 29 29 | 3b 0d 09 43 6c 69 70 52 |wRgn()))|;..ClipR|
|00002650| 65 63 74 28 77 72 61 70 | 42 6f 78 29 3b 0d 09 62 |ect(wrap|Box);..b|
|00002660| 6f 78 57 69 64 74 68 20 | 3d 20 77 72 61 70 42 6f |oxWidth |= wrapBo|
|00002670| 78 2d 3e 72 69 67 68 74 | 20 2d 20 77 72 61 70 42 |x->right| - wrapB|
|00002680| 6f 78 2d 3e 6c 65 66 74 | 3b 0d 09 66 69 78 65 64 |ox->left|;..fixed|
|00002690| 4d 61 78 20 3d 20 4c 6f | 6e 67 32 46 69 78 28 28 |Max = Lo|ng2Fix((|
|000026a0| 6c 6f 6e 67 29 62 6f 78 | 57 69 64 74 68 29 3b 0d |long)box|Width);.|
|000026b0| 09 69 66 20 28 61 6c 69 | 67 6e 20 3d 3d 20 74 65 |.if (ali|gn == te|
|000026c0| 46 6c 75 73 68 44 65 66 | 61 75 6c 74 29 0d 09 09 |FlushDef|ault)...|
|000026d0| 61 6c 69 67 6e 20 3d 20 | 47 65 74 53 79 73 44 69 |align = |GetSysDi|
|000026e0| 72 65 63 74 69 6f 6e 28 | 29 3b 0d 0d 09 2f 2a 0d |rection(|);.../*.|
|000026f0| 09 20 20 4e 6f 77 20 77 | 65 20 63 61 6c 6c 20 4e |. Now w|e call N|
|00002700| 54 42 4c 69 6e 65 48 65 | 69 67 68 74 20 74 6f 20 |TBLineHe|ight to |
|00002710| 63 61 6c 63 75 6c 61 74 | 65 20 74 68 65 20 61 70 |calculat|e the ap|
|00002720| 70 72 6f 70 72 69 61 74 | 65 20 6c 69 6e 65 20 68 |propriat|e line h|
|00002730| 65 69 67 68 74 2e 20 20 | 49 74 0d 09 20 20 61 6c |eight. |It.. al|
|00002740| 73 6f 20 66 69 67 75 72 | 65 73 20 6f 75 72 20 73 |so figur|es our s|
|00002750| 74 61 72 74 69 6e 67 20 | 76 65 72 74 69 63 61 6c |tarting |vertical|
|00002760| 20 70 65 6e 20 6c 6f 63 | 61 74 69 6f 6e 20 69 6e | pen loc|ation in|
|00002770| 20 63 75 72 59 20 62 61 | 73 65 64 20 6f 6e 20 74 | curY ba|sed on t|
|00002780| 68 65 0d 09 20 20 6c 69 | 6e 65 20 68 65 69 67 68 |he.. li|ne heigh|
|00002790| 74 20 61 6e 64 20 6f 74 | 68 65 72 20 6d 65 74 72 |t and ot|her metr|
|000027a0| 69 63 20 70 61 72 61 6d | 65 74 65 72 73 2e 20 20 |ic param|eters. |
|000027b0| 43 6c 65 61 72 20 6c 69 | 6e 65 43 6f 75 6e 74 2c |Clear li|neCount,|
|000027c0| 20 73 65 74 0d 09 20 20 | 6c 69 6e 65 53 74 61 72 | set.. |lineStar|
|000027d0| 74 20 74 6f 20 70 6f 69 | 6e 74 20 74 6f 20 74 68 |t to poi|nt to th|
|000027e0| 65 20 62 65 67 69 6e 6e | 69 6e 67 20 6f 66 20 74 |e beginn|ing of t|
|000027f0| 68 65 20 74 65 78 74 2c | 20 63 61 6c 63 75 6c 61 |he text,| calcula|
|00002800| 74 65 20 74 65 78 74 45 | 6e 64 20 66 6f 72 0d 09 |te textE|nd for..|
|00002810| 20 20 63 6f 6d 70 61 72 | 69 73 6f 6e 20 74 6f 20 | compar|ison to |
|00002820| 6b 6e 6f 77 20 77 68 65 | 6e 20 77 65 27 72 65 20 |know whe|n we're |
|00002830| 64 6f 6e 65 2c 20 61 6e | 64 20 70 72 65 73 65 74 |done, an|d preset|
|00002840| 20 74 65 78 74 4c 65 66 | 74 20 74 6f 20 62 65 20 | textLef|t to be |
|00002850| 61 6c 6c 20 74 68 65 0d | 09 20 20 74 65 78 74 2e |all the.|. text.|
|00002860| 0d 09 2a 2f 0d 0d 09 6c | 69 6e 65 48 65 69 67 68 |..*/...l|ineHeigh|
|00002870| 74 20 3d 20 4e 54 42 4c | 69 6e 65 48 65 69 67 68 |t = NTBL|ineHeigh|
|00002880| 74 28 74 68 65 54 65 78 | 74 2c 20 74 65 78 74 4c |t(theTex|t, textL|
|00002890| 65 6e 2c 20 77 72 61 70 | 42 6f 78 2c 20 6c 68 43 |en, wrap|Box, lhC|
|000028a0| 6f 64 65 2c 20 26 63 75 | 72 59 29 3b 0d 09 6c 69 |ode, &cu|rY);..li|
|000028b0| 6e 65 43 6f 75 6e 74 20 | 3d 20 30 3b 0d 09 6c 69 |neCount |= 0;..li|
|000028c0| 6e 65 53 74 61 72 74 20 | 3d 20 74 68 65 54 65 78 |neStart |= theTex|
|000028d0| 74 3b 0d 09 74 65 78 74 | 45 6e 64 20 3d 20 74 68 |t;..text|End = th|
|000028e0| 65 54 65 78 74 20 2b 20 | 74 65 78 74 4c 65 6e 3b |eText + |textLen;|
|000028f0| 0d 09 74 65 78 74 4c 65 | 66 74 20 3d 20 74 65 78 |..textLe|ft = tex|
|00002900| 74 4c 65 6e 3b 0d 0d 09 | 2f 2a 0d 09 20 20 54 68 |tLen;...|/*.. Th|
|00002910| 69 73 20 69 73 20 74 68 | 65 20 6d 61 69 6e 20 77 |is is th|e main w|
|00002920| 72 61 70 2d 61 6e 64 2d | 64 72 61 77 20 6c 6f 6f |rap-and-|draw loo|
|00002930| 70 2e 20 20 49 20 62 65 | 74 20 79 6f 75 20 6e 65 |p. I be|t you ne|
|00002940| 76 65 72 20 74 68 6f 75 | 67 68 74 20 77 72 61 70 |ver thou|ght wrap|
|00002950| 70 69 6e 67 0d 09 20 20 | 74 65 78 74 20 63 6f 75 |ping.. |text cou|
|00002960| 6c 64 20 62 65 20 73 6f | 20 65 61 73 79 2e 2e 2e |ld be so| easy...|
|00002970| 0d 09 2a 2f 0d 0d 09 64 | 6f 0d 09 7b 0d 0d 09 09 |..*/...d|o..{....|
|00002980| 2f 2a 0d 09 09 20 20 45 | 76 65 72 79 20 6c 69 6e |/*... E|very lin|
|00002990| 65 2c 20 77 65 20 68 61 | 76 65 20 74 6f 20 70 72 |e, we ha|ve to pr|
|000029a0| 65 73 65 74 20 6c 69 6e | 65 42 79 74 65 73 20 74 |eset lin|eBytes t|
|000029b0| 6f 20 73 6f 6d 65 74 68 | 69 6e 67 20 6e 6f 6e 2d |o someth|ing non-|
|000029c0| 7a 65 72 6f 2e 0d 09 09 | 20 20 54 68 69 73 20 74 |zero....| This t|
|000029d0| 65 6c 6c 73 20 53 74 79 | 6c 65 64 4c 69 6e 65 42 |ells Sty|ledLineB|
|000029e0| 72 65 61 6b 20 74 68 61 | 74 20 77 65 27 72 65 20 |reak tha|t we're |
|000029f0| 64 72 61 77 69 6e 67 20 | 74 68 65 20 66 69 72 73 |drawing |the firs|
|00002a00| 74 20 66 6f 72 6d 61 74 | 0d 09 09 20 20 72 75 6e |t format|... run|
|00002a10| 20 6f 6e 20 74 68 65 20 | 6c 69 6e 65 20 28 6f 66 | on the |line (of|
|00002a20| 20 63 6f 75 72 73 65 2c | 20 66 6f 72 20 75 73 2c | course,| for us,|
|00002a30| 20 74 68 65 72 65 27 73 | 20 6f 6e 6c 79 20 4f 4e | there's| only ON|
|00002a40| 45 20 66 6f 72 6d 61 74 | 20 72 75 6e 0d 09 09 20 |E format| run... |
|00002a50| 20 74 6f 74 61 6c 29 2e | 20 20 41 6c 73 6f 20 70 | total).| Also p|
|00002a60| 72 65 73 65 74 20 77 72 | 61 70 57 69 64 2e 20 20 |reset wr|apWid. |
|00002a70| 53 74 79 6c 65 64 4c 69 | 6e 65 42 72 65 61 6b 20 |StyledLi|neBreak |
|00002a80| 77 69 6c 6c 20 61 6c 77 | 61 79 73 20 6d 6f 64 69 |will alw|ays modi|
|00002a90| 66 79 0d 09 09 20 20 6c | 69 6e 65 42 79 74 65 73 |fy... l|ineBytes|
|00002aa0| 20 28 74 6f 20 74 65 6c | 6c 20 79 6f 75 20 68 6f | (to tel|l you ho|
|00002ab0| 77 20 6d 61 6e 79 20 62 | 79 74 65 73 20 61 72 65 |w many b|ytes are|
|00002ac0| 20 6f 6e 20 74 68 69 73 | 20 6c 69 6e 65 29 2c 20 | on this| line), |
|00002ad0| 61 6e 64 20 77 69 6c 6c | 0d 09 09 20 20 6d 6f 64 |and will|... mod|
|00002ae0| 69 66 79 20 77 72 61 70 | 57 69 64 2c 20 73 6f 20 |ify wrap|Wid, so |
|00002af0| 77 65 20 68 61 76 65 20 | 74 6f 20 72 65 73 65 74 |we have |to reset|
|00002b00| 20 74 68 65 6d 20 65 61 | 63 68 20 6c 69 6e 65 2e | them ea|ch line.|
|00002b10| 0d 09 09 2a 2f 0d 0d 09 | 09 6c 69 6e 65 42 79 74 |...*/...|.lineByt|
|00002b20| 65 73 20 3d 20 31 3b 0d | 09 09 77 72 61 70 57 69 |es = 1;.|..wrapWi|
|00002b30| 64 20 3d 20 66 69 78 65 | 64 4d 61 78 3b 0d 0d 09 |d = fixe|dMax;...|
|00002b40| 09 62 72 65 61 6b 43 6f | 64 65 20 3d 20 53 74 79 |.breakCo|de = Sty|
|00002b50| 6c 65 64 4c 69 6e 65 42 | 72 65 61 6b 28 28 50 74 |ledLineB|reak((Pt|
|00002b60| 72 29 6c 69 6e 65 53 74 | 61 72 74 2c 20 74 65 78 |r)lineSt|art, tex|
|00002b70| 74 4c 65 66 74 2c 20 30 | 2c 20 74 65 78 74 4c 65 |tLeft, 0|, textLe|
|00002b80| 66 74 2c 20 30 2c 20 26 | 77 72 61 70 57 69 64 2c |ft, 0, &|wrapWid,|
|00002b90| 20 26 6c 69 6e 65 42 79 | 74 65 73 29 3b 0d 0d 09 | &lineBy|tes);...|
|00002ba0| 09 2f 2a 0d 09 09 20 20 | 4e 6f 77 20 74 68 61 74 |./*... |Now that|
|00002bb0| 20 74 68 65 20 53 63 72 | 69 70 74 20 4d 61 6e 61 | the Scr|ipt Mana|
|00002bc0| 67 65 72 20 68 61 73 20 | 64 6f 6e 65 20 61 6c 6c |ger has |done all|
|00002bd0| 20 74 68 65 20 72 65 61 | 6c 6c 79 20 68 61 72 64 | the rea|lly hard|
|00002be0| 20 77 6f 72 6b 20 66 6f | 72 0d 09 09 20 20 75 73 | work fo|r... us|
|00002bf0| 2c 20 77 65 20 64 72 61 | 77 20 74 68 65 20 6c 69 |, we dra|w the li|
|00002c00| 6e 65 2e 20 20 57 65 20 | 61 6c 72 65 61 64 79 20 |ne. We |already |
|00002c10| 6b 6e 65 77 20 6c 69 6e | 65 53 74 61 72 74 2c 20 |knew lin|eStart, |
|00002c20| 53 74 79 6c 65 64 4c 69 | 6e 65 42 72 65 61 6b 0d |StyledLi|neBreak.|
|00002c30| 09 09 20 20 67 61 76 65 | 20 75 73 20 6c 69 6e 65 |.. gave| us line|
|00002c40| 42 79 74 65 73 2c 20 77 | 68 69 63 68 20 77 65 20 |Bytes, w|hich we |
|00002c50| 70 61 73 73 20 74 6f 20 | 4e 54 42 44 72 61 77 2e |pass to |NTBDraw.|
|00002c60| 20 20 49 74 27 6c 6c 20 | 68 61 6e 64 6c 65 20 74 | It'll |handle t|
|00002c70| 68 65 0d 09 09 20 20 64 | 69 66 66 65 72 65 6e 74 |he... d|ifferent|
|00002c80| 20 74 65 78 74 20 61 6c | 69 67 6e 6d 65 6e 74 73 | text al|ignments|
|00002c90| 20 69 74 73 65 6c 66 2e | 0d 09 09 2a 2f 0d 0d 09 | itself.|...*/...|
|00002ca0| 09 4e 54 42 44 72 61 77 | 28 62 72 65 61 6b 43 6f |.NTBDraw|(breakCo|
|00002cb0| 64 65 2c 20 6c 69 6e 65 | 53 74 61 72 74 2c 20 6c |de, line|Start, l|
|00002cc0| 69 6e 65 42 79 74 65 73 | 2c 20 77 72 61 70 42 6f |ineBytes|, wrapBo|
|00002cd0| 78 2c 20 61 6c 69 67 6e | 2c 20 63 75 72 59 2c 20 |x, align|, curY, |
|00002ce0| 62 6f 78 57 69 64 74 68 | 29 3b 0d 0d 09 09 2f 2a |boxWidth|);..../*|
|00002cf0| 0d 09 09 20 20 4e 6f 77 | 20 77 65 20 61 64 76 61 |... Now| we adva|
|00002d00| 6e 63 65 20 6f 75 72 20 | 76 65 72 74 69 63 61 6c |nce our |vertical|
|00002d10| 20 70 6f 73 69 74 69 6f | 6e 20 64 6f 77 6e 20 62 | positio|n down b|
|00002d20| 79 20 74 68 65 20 68 65 | 69 67 68 74 20 6f 66 20 |y the he|ight of |
|00002d30| 6f 6e 65 0d 09 09 20 20 | 6c 69 6e 65 2c 20 61 64 |one... |line, ad|
|00002d40| 76 61 6e 63 65 20 6c 69 | 6e 65 53 74 61 72 74 20 |vance li|neStart |
|00002d50| 62 79 20 74 68 65 20 6e | 75 6d 62 65 72 20 6f 66 |by the n|umber of|
|00002d60| 20 62 79 74 65 73 20 77 | 65 20 6a 75 73 74 20 64 | bytes w|e just d|
|00002d70| 72 65 77 2c 0d 09 09 20 | 20 63 61 6c 63 75 6c 61 |rew,... | calcula|
|00002d80| 74 65 20 61 20 6e 65 77 | 20 74 65 78 74 4c 65 66 |te a new| textLef|
|00002d90| 74 2c 20 61 6e 64 20 69 | 6e 63 72 65 6d 65 6e 74 |t, and i|ncrement|
|00002da0| 20 6f 75 72 20 6c 69 6e | 65 20 63 6f 75 6e 74 2e | our lin|e count.|
|00002db0| 0d 09 09 2a 2f 0d 0d 09 | 09 63 75 72 59 20 2b 3d |...*/...|.curY +=|
|00002dc0| 20 6c 69 6e 65 48 65 69 | 67 68 74 3b 0d 09 09 6c | lineHei|ght;...l|
|00002dd0| 69 6e 65 53 74 61 72 74 | 20 2b 3d 20 6c 69 6e 65 |ineStart| += line|
|00002de0| 42 79 74 65 73 3b 0d 09 | 09 74 65 78 74 4c 65 66 |Bytes;..|.textLef|
|00002df0| 74 20 2d 3d 20 6c 69 6e | 65 42 79 74 65 73 3b 0d |t -= lin|eBytes;.|
|00002e00| 09 09 6c 69 6e 65 43 6f | 75 6e 74 2b 2b 3b 0d 0d |..lineCo|unt++;..|
|00002e10| 09 7d 20 77 68 69 6c 65 | 20 28 6c 69 6e 65 53 74 |.} while| (lineSt|
|00002e20| 61 72 74 20 3c 20 74 65 | 78 74 45 6e 64 29 3b 0d |art < te|xtEnd);.|
|00002e30| 0d 09 2f 2a 0d 09 20 20 | 57 65 6c 6c 20 74 68 61 |../*.. |Well tha|
|00002e40| 74 20 77 61 73 20 61 20 | 6a 6f 62 20 77 65 6c 6c |t was a |job well|
|00002e50| 20 64 6f 6e 65 2e 20 20 | 4c 65 74 27 73 20 72 65 | done. |Let's re|
|00002e60| 74 75 72 6e 20 73 6f 6d | 65 20 75 73 65 66 75 6c |turn som|e useful|
|00002e70| 20 76 61 6c 75 65 73 2c | 20 74 6f 6f 2e 0d 09 20 | values,| too... |
|00002e80| 20 49 66 20 74 68 65 20 | 75 73 65 72 20 67 61 76 | If the |user gav|
|00002e90| 65 20 70 6f 69 6e 74 65 | 72 73 20 66 6f 72 20 65 |e pointe|rs for e|
|00002ea0| 6e 64 59 20 61 6e 64 20 | 6c 68 55 73 65 64 2c 20 |ndY and |lhUsed, |
|00002eb0| 77 65 20 73 74 75 66 66 | 20 6f 75 72 20 65 6e 64 |we stuff| our end|
|00002ec0| 69 6e 67 0d 09 20 20 76 | 65 72 74 69 63 61 6c 20 |ing.. v|ertical |
|00002ed0| 63 6f 6f 72 64 69 6e 61 | 74 65 20 61 6e 64 20 74 |coordina|te and t|
|00002ee0| 68 65 20 6c 69 6e 65 20 | 68 65 69 67 68 74 20 77 |he line |height w|
|00002ef0| 65 20 63 61 6c 63 75 6c | 61 74 65 64 20 69 6e 74 |e calcul|ated int|
|00002f00| 6f 20 74 68 6f 73 65 2c | 0d 09 20 20 72 65 73 70 |o those,|.. resp|
|00002f10| 65 63 74 69 76 65 6c 79 | 2e 20 20 54 68 65 73 65 |ectively|. These|
|00002f20| 20 61 6c 6c 6f 77 20 74 | 68 65 20 67 75 79 20 74 | allow t|he guy t|
|00002f30| 6f 20 70 75 74 20 73 6f | 6d 65 74 68 69 6e 67 20 |o put so|mething |
|00002f40| 61 66 74 65 72 20 74 68 | 65 20 77 72 61 70 70 65 |after th|e wrappe|
|00002f50| 64 0d 09 20 20 74 65 78 | 74 20 28 6f 72 20 61 74 |d.. tex|t (or at|
|00002f60| 20 6c 65 61 73 74 20 6b | 6e 6f 77 20 74 68 65 20 | least k|now the |
|00002f70| 72 69 67 68 74 20 70 6c | 61 63 65 20 74 6f 20 70 |right pl|ace to p|
|00002f80| 75 74 20 69 74 29 2e 0d | 09 2a 2f 0d 0d 09 69 66 |ut it)..|.*/...if|
|00002f90| 20 28 65 6e 64 59 29 0d | 09 09 2a 65 6e 64 59 20 | (endY).|..*endY |
|00002fa0| 3d 20 63 75 72 59 20 2d | 20 6c 69 6e 65 48 65 69 |= curY -| lineHei|
|00002fb0| 67 68 74 3b 0d 09 69 66 | 20 28 6c 68 55 73 65 64 |ght;..if| (lhUsed|
|00002fc0| 29 0d 09 09 2a 6c 68 55 | 73 65 64 20 3d 20 6c 69 |)...*lhU|sed = li|
|00002fd0| 6e 65 48 65 69 67 68 74 | 3b 0d 0d 09 2f 2a 0d 09 |neHeight|;.../*..|
|00002fe0| 20 20 46 69 6e 61 6c 6c | 79 2c 20 72 65 73 74 6f | Finall|y, resto|
|00002ff0| 72 65 20 74 68 65 20 63 | 6c 69 70 70 69 6e 67 20 |re the c|lipping |
|00003000| 72 65 67 69 6f 6e 2c 20 | 64 69 73 70 6f 73 65 20 |region, |dispose |
|00003010| 6f 66 20 74 68 65 20 72 | 65 67 69 6f 6e 2c 20 61 |of the r|egion, a|
|00003020| 6e 64 0d 09 20 20 72 65 | 74 75 72 6e 20 74 68 65 |nd.. re|turn the|
|00003030| 20 54 4f 54 41 4c 20 6e | 75 6d 62 65 72 20 6f 66 | TOTAL n|umber of|
|00003040| 20 6c 69 6e 65 73 20 64 | 72 61 77 6e 20 28 6e 6f | lines d|rawn (no|
|00003050| 74 65 20 74 68 61 74 20 | 77 65 20 64 69 64 6e 27 |te that |we didn'|
|00003060| 74 20 73 74 6f 70 0d 09 | 20 20 64 72 61 77 69 6e |t stop..| drawin|
|00003070| 67 20 77 68 65 6e 20 63 | 75 72 59 20 61 64 76 61 |g when c|urY adva|
|00003080| 6e 63 65 64 20 70 61 73 | 74 20 77 72 61 70 42 6f |nced pas|t wrapBo|
|00003090| 78 2d 3e 62 6f 74 74 6f | 6d 2e 20 20 54 68 69 73 |x->botto|m. This|
|000030a0| 20 77 61 79 2c 20 74 68 | 65 20 75 73 65 72 0d 09 | way, th|e user..|
|000030b0| 20 20 63 6f 75 6c 64 20 | 74 65 6c 6c 20 74 68 61 | could |tell tha|
|000030c0| 74 20 74 68 65 20 74 65 | 78 74 20 6f 76 65 72 66 |t the te|xt overf|
|000030d0| 6c 6f 77 65 64 20 77 72 | 61 70 42 6f 78 2e 20 20 |lowed wr|apBox. |
|000030e0| 49 66 20 79 6f 75 20 77 | 61 6e 74 20 74 6f 20 6b |If you w|ant to k|
|000030f0| 6e 6f 77 20 68 6f 77 0d | 09 20 20 6d 61 6e 79 20 |now how.|. many |
|00003100| 6c 69 6e 65 73 20 66 69 | 74 2c 20 64 69 76 69 64 |lines fi|t, divid|
|00003110| 65 20 77 72 61 70 42 6f | 78 20 62 79 20 6c 68 55 |e wrapBo|x by lhU|
|00003120| 73 65 64 2e 20 20 54 68 | 69 73 20 77 61 79 2c 20 |sed. Th|is way, |
|00003130| 79 6f 75 20 67 65 74 20 | 74 68 65 20 62 65 73 74 |you get |the best|
|00003140| 0d 09 20 20 6f 66 20 62 | 6f 74 68 20 77 6f 72 6c |.. of b|oth worl|
|00003150| 64 73 2e 0d 09 2a 2f 0d | 0d 09 53 65 74 43 6c 69 |ds...*/.|..SetCli|
|00003160| 70 28 6f 6c 64 43 6c 69 | 70 29 3b 0d 09 44 69 73 |p(oldCli|p);..Dis|
|00003170| 70 6f 73 65 52 67 6e 28 | 6f 6c 64 43 6c 69 70 29 |poseRgn(|oldClip)|
|00003180| 3b 0d 0d 09 72 65 74 75 | 72 6e 20 28 6c 69 6e 65 |;...retu|rn (line|
|00003190| 43 6f 75 6e 74 29 3b 0d | 7d 0d 0d 0d 00 00 00 00 |Count);.|}.......|
|000031a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000031f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003200| 00 00 01 00 00 00 01 c2 | 00 00 00 c2 00 00 00 72 |........|.......r|
|00003210| 00 01 e0 57 00 01 e0 58 | 00 00 e0 59 00 00 e0 5a |...W...X|...Y...Z|
|00003220| 00 00 e0 5b 00 00 e0 5c | 00 00 e0 5d 00 00 e0 5e |...[...\|...]...^|
|00003230| 0c 4e 65 6f 54 65 78 74 | 42 6f 78 2e 63 74 02 00 |.NeoText|Box.ct..|
|00003240| 00 00 54 45 58 54 43 57 | 49 45 01 00 00 68 01 00 |..TEXTCW|IE...h..|
|00003250| 00 00 54 45 58 54 43 57 | 49 45 01 00 00 68 01 00 |..TEXTCW|IE...h..|
|00003260| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003270| 00 00 a4 e3 9e 3b 00 00 | 31 1c 00 00 02 34 03 37 |.....;..|1....4.7|
|00003280| 2e 30 24 37 2e 30 2c 20 | a9 41 70 70 6c 65 20 43 |.0$7.0, |.Apple C|
|00003290| 6f 6d 70 75 74 65 72 2c | 20 49 6e 63 2e 20 31 39 |omputer,| Inc. 19|
|000032a0| 38 33 2d 31 39 39 31 00 | 00 00 04 03 37 2e 30 00 |83-1991.|....7.0.|
|000032b0| 00 00 78 00 06 00 5a 00 | 00 00 0e 00 5f 00 00 00 |..x...Z.|...._...|
|000032c0| 06 0b 54 00 5f 00 00 00 | 14 0a 54 00 5f 00 00 00 |..T._...|..T._...|
|000032d0| 22 0c 54 00 5f 00 00 00 | 30 10 54 00 5f 00 00 00 |".T._...|0.T._...|
|000032e0| 42 09 48 00 5f 00 00 00 | 48 0e 48 00 5f 00 00 00 |B.H._...|H.H._...|
|000032f0| 56 11 48 00 5f 00 00 00 | 64 15 48 00 53 00 00 00 |V.H._...|d.H.S...|
|00003300| 00 00 00 08 00 49 00 62 | 01 bb 02 71 00 00 00 3c |.....I.b|...q...<|
|00003310| 00 03 00 00 21 7c 00 00 | 21 86 0b 4e 65 6f 54 65 |....!|..|!..NeoTe|
|00003320| 78 74 42 6f 78 00 00 00 | 12 15 00 00 12 1c 07 4e |xtBox...|.......N|
|00003330| 54 42 44 72 61 77 00 00 | 06 a9 00 00 06 b6 0d 4e |TBDraw..|.......N|
|00003340| 54 42 4c 69 6e 65 48 65 | 69 67 68 74 00 00 00 1e |TBLineHe|ight....|
|00003350| 00 5e 00 10 01 d0 02 74 | 00 5e 00 10 01 d0 02 74 |.^.....t|.^.....t|
|00003360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003370| 00 48 00 09 4d 6f 6e 61 | 63 6f 00 00 00 00 00 00 |.H..Mona|co......|
|00003380| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003390| 00 00 00 00 00 03 00 04 | 00 5e 00 10 02 c3 02 90 |........|.^......|
|000033a0| 00 5e 00 10 02 c3 02 90 | ad fc 28 ed 00 00 00 00 |.^......|..(.....|
|000033b0| 00 00 00 00 00 00 00 00 | 01 00 00 00 00 04 00 01 |........|........|
|000033c0| 00 01 00 00 01 00 00 00 | 01 c2 00 00 00 c2 00 00 |........|........|
|000033d0| 00 72 02 b0 f3 38 30 1c | 00 00 00 1c 00 72 00 02 |.r...80.|.....r..|
|000033e0| 4d 50 53 52 00 02 00 1a | 52 45 43 54 00 00 00 3e |MPSR....|RECT...>|
|000033f0| 4d 57 42 42 00 00 00 4a | 03 ef ff ff 00 00 00 0c |MWBB...J|........|
|00003400| 00 00 00 00 03 f0 ff ff | 00 00 00 4c 00 00 00 00 |........|...L....|
|00003410| 03 ed ff ff 00 00 00 6e | 00 00 00 00 00 00 ff ff |.......n|........|
|00003420| 00 00 00 00 00 00 00 00 | 03 f0 ff ff 00 00 00 ba |........|........|
|00003430| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003440| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003450| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003460| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00003470| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+